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

exception declaration of unclosed polymorphic variant type are not rejected by the typechecker. #4497

Closed
vicuna opened this Issue Feb 4, 2008 · 3 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Feb 4, 2008

Original bug ID: 4497
Reporter: till
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2010-04-29T12:25:59Z)
Resolution: fixed
Priority: normal
Severity: crash
Version: 3.10.1
Fixed in version: 3.10.1
Category: ~DO NOT USE (was: OCaml general)

Bug description

The type checker accepts exception definitions like:

exception PolVar of [>]

which can be used to redefine Obj.magic like functions:

let mag i = try
raise (PolVar (R i)) with PolVar (R i) -> i

leading to potential segFaults:

let () = print_string (mag 0)

Additional information

`

File attachments

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 4, 2008

Comment author: @garrigue

I cannot reproduce here with 3.10.1.
Are you sure about the version?
This bug was fixed a long time ago (it is already corrected in 3.09.3)

Note that there is a similar bug with objects in 3.10.1, but is already
fixed in CVS too.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 4, 2008

Comment author: till

My ocaml version is:
3.10.1+dev0 (2007-05-21)

After trying is out a little more thoroughly (which I should have done before submitting the bug) it turns out that, if I do not provide the mli file I get:

The implementation polcrash.ml
does not match the interface (inferred signature):
Exception declarations do not match:
exception PolVar of [> ]
is not included in
exception PolVar of [> ]

This compilation error can be subverted using a blank interface.

So currently the attached file will segfault ocaml but not compile. Providing an empty interface will get it to compile.

HTH

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 4, 2008

Comment author: @garrigue

Already fixed in 3.10.1.
This was originally reported by Zheng Li on the caml-list (2007-11-09).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.