stedolan / malfunction

Malfunctional Programming
Other
338 stars 19 forks source link

Fix out of bounds vector write in `malfunction_interpreter.ml` #37

Closed yforster closed 11 months ago

yforster commented 11 months ago

The condition if 0 <= i && i <= Array.length vals then for Mvecset lets the interpreter crash on (let ($x (makevec 0 0)) (store $x 0 0)) with Fatal error: exception Invalid_argument("index out of bounds") rather than report Undefined behaviour: index out of bounds: 0.

The check is correct for Mvecget.

Discovered by @tabareau

stedolan commented 11 months ago

Thanks for spotting this