Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
exception declaration of unclosed polymorphic variant type are not rejected by the typechecker. #4497
Original bug ID: 4497
The type checker accepts exception definitions like:
exception PolVar of [>]
which can be used to redefine Obj.magic like functions:
let mag i = try
leading to potential segFaults:
let () = print_string (mag 0)
Comment author: @garrigue
I cannot reproduce here with 3.10.1.
Note that there is a similar bug with objects in 3.10.1, but is already
Comment author: till
My ocaml version is:
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
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.