Navigation Menu

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

Weak.create should reject negative lengths #7795

Closed
vicuna opened this issue May 13, 2018 · 2 comments
Closed

Weak.create should reject negative lengths #7795

vicuna opened this issue May 13, 2018 · 2 comments

Comments

@vicuna
Copy link

vicuna commented May 13, 2018

Original bug ID: 7795
Reporter: @kayceesrk
Status: resolved (set by @xavierleroy on 2018-05-21T16:44:32Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 4.08.0+dev/beta1/beta2
Category: standard library
Monitored by: @gasche

Bug description

Weak.create accepts -1 for the length. It should raise Invalid_argument for negative lengths. It appears that the bounds check in caml_weak_create is off by one.

Steps to reproduce

$ ocaml
OCaml version 4.08.0+dev0-2018-04-09

let v = Weak.create (-1);;

val v : '_weak1 Weak.t =

Weak.length v;;

  • : int = -1
@vicuna
Copy link
Author

vicuna commented May 13, 2018

Comment author: @kayceesrk

I've opened #1782 which fixes this bug.

@vicuna
Copy link
Author

vicuna commented May 21, 2018

Comment author: @xavierleroy

GPR was merged in trunk.

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