Skip to content

Commit

Permalink
Fix effective_address overflow check
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewagner committed Oct 15, 2015
1 parent be16c5e commit 6867335
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ml-proto/spec/memory.ml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ let grow mem n =
mem := after

let effective_address a o =
if (Int64.sub Int64.max_int a) < o then raise Bounds;
Int64.add a o
let ea = Int64.add a o in
if I64.lt_u ea a then raise Bounds;
ea

let rec loadn mem n ea =
assert (n > 0 && n <= 8);
Expand Down

0 comments on commit 6867335

Please sign in to comment.