Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re: [Caml-devel] wish: validation when retrieving public methods (PR#3760) #3761

Closed
vicuna opened this issue Aug 17, 2005 · 2 comments
Closed

Comments

@vicuna
Copy link

vicuna commented Aug 17, 2005

Original bug ID: 3761
Reporter: administrator
Status: closed (set by @garrigue on 2008-01-25T08:37:56Z)
Resolution: fixed
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Child of: #3760
Monitored by: n8gray

Bug description

From: n8gray@caltech.edu

The C interface to ocaml offers the caml_get_public_method function
for retrieving a closure by hash from an object's method table.
Unfortunately, this function always returns some method, even if the
table doesn't contain the requested method! It seems
caml_get_public_method doesn't check that the hash you supplied
matches the hash it found. It would be nice if either: a)
caml_get_public_method verified that it found the correct method and
returned NULL if it didn't, or b) you provided a separate function
caml_get_valid_public_method that does so.

This does not seem a bad idea, since the tags are in the table.
There is however a pitfall: due to the hashing approach used, tags are
not guaranteed to be unique. That is, even if the found tag were to be
checked, this is not a guarantee that the right method has been found.
But the probability is sufficiently low that at least it would help for
debugging.

Anyway, thanks for your suggestion, which will be considered.

Jacques

@vicuna
Copy link
Author

vicuna commented Aug 26, 2005

Comment author: administrator

see #3760

@vicuna
Copy link
Author

vicuna commented Jan 25, 2008

Comment author: @garrigue

See 3760.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant