Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004497OCamlOCaml generalpublic2008-02-04 09:552010-04-29 14:25
Assigned Togarrigue 
PlatformOSOS Version
Product Version3.10.1 
Target VersionFixed in Version3.10.1 
Summary0004497: exception declaration of unclosed polymorphic variant type are not rejected by the typechecker.
DescriptionThe 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`
TagsNo tags attached.
Attached Files? file icon [^] (121 bytes) 2008-02-04 10:54 [Show Content]

- Relationships

-  Notes
garrigue (manager)
2008-02-04 10:11

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.
till (reporter)
2008-02-04 10:53
edited on: 2008-02-04 10:54

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
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.


garrigue (manager)
2008-02-04 14:28

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

- Issue History
Date Modified Username Field Change
2008-02-04 09:55 till New Issue
2008-02-04 10:11 garrigue Note Added: 0004443
2008-02-04 10:53 till Note Added: 0004444
2008-02-04 10:54 till Note Edited: 0004444
2008-02-04 10:54 till File Added:
2008-02-04 14:28 garrigue Status new => resolved
2008-02-04 14:28 garrigue Fixed in Version => 3.10.1
2008-02-04 14:28 garrigue Resolution open => fixed
2008-02-04 14:28 garrigue Assigned To => garrigue
2008-02-04 14:28 garrigue Note Added: 0004445
2010-04-29 14:25 xleroy Status resolved => closed

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker