diff options
author | varobert <varobert@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2012-04-04 11:59:40 +0000 |
---|---|---|
committer | varobert <varobert@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2012-04-04 11:59:40 +0000 |
commit | 32a6fcb12814550633261960b540ffeb8a0fcab5 (patch) | |
tree | d6b180cba9277f76bb70d7a0ee81b05e50811211 /checklink/Fuzz.ml | |
parent | 3498607028a17be29cd2fbc3b1f48f2847915ce3 (diff) | |
download | compcert-32a6fcb12814550633261960b540ffeb8a0fcab5.tar.gz compcert-32a6fcb12814550633261960b540ffeb8a0fcab5.zip |
Added safety to potentially overflowing arithmetics
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1872 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'checklink/Fuzz.ml')
-rw-r--r-- | checklink/Fuzz.ml | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/checklink/Fuzz.ml b/checklink/Fuzz.ml index c1f67801..fb7bee7b 100644 --- a/checklink/Fuzz.ml +++ b/checklink/Fuzz.ml @@ -9,7 +9,7 @@ let fuzz_debug = ref false let string_of_byte = Printf.sprintf "0x%02x" let full_range_of_byte elfmap byte = - let byte = int_int32 byte in + let byte = Int32.of_int byte in List.find (fun (a, b, _, _) -> a <= byte && byte <= b) elfmap let range_of_byte elfmap byte = @@ -23,7 +23,7 @@ let fuzz_check elfmap bs byte old sdumps = let is_error = function ERROR(_) -> true | _ -> false in let (str, _, _) = bs in let fuzz_description = - string_of_int32 (int_int32 byte) ^ " <- " ^ + string_of_int32 (Int32.of_int byte) ^ " <- " ^ string_of_byte (Char.code str.[byte]) ^ " (was " ^ string_of_byte (Char.code old) ^ ") - " ^ string_of_byte_chunk_desc (range_of_byte elfmap byte) @@ -51,7 +51,7 @@ let fuzz_check elfmap bs byte old sdumps = | Assert_failure(s, l, c) -> if !fuzz_debug then Printf.printf "fuzz_check failed an assertion at %s (%d, %d)\n" s l c - | Library.Integer_overflow -> + | Exc.IntOverflow | Exc.Int32Overflow -> if !fuzz_debug then Printf.printf "fuzz_check raised an integer overflow exception\n" | Match_failure(s, l, c) -> @@ -74,8 +74,8 @@ let fuzz_check elfmap bs byte old sdumps = *) let ok_fuzz elfmap str byte fuzz = let (a, b, _, r) = full_range_of_byte elfmap byte in - let a = int32_int a in - let b = int32_int b in + let a = Safe32.to_int a in + let b = Safe32.to_int b in let old = Char.code str.[byte] in let fuz = Char.code fuzz in match r with |