From ed55884ea9749f93ffd67f0734da0907fe338102 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 31 Jan 2017 14:44:05 +0100 Subject: Avoid overflows and report an error. Instead of multiplying the array constant directly with the size of the offset the cautious_mul function is used to detect potential overflows. Bug 20765 --- cparser/Cutil.mli | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cparser/Cutil.mli') diff --git a/cparser/Cutil.mli b/cparser/Cutil.mli index a849d1fe..ee3c7625 100644 --- a/cparser/Cutil.mli +++ b/cparser/Cutil.mli @@ -114,6 +114,9 @@ val struct_layout: val offsetof: Env.t -> typ -> field -> int (* Compute the offset of a struct member *) +val cautious_mul: int64 -> int -> int option +(* Overflow-avoiding multiplication of an int64 and an int, with + result in type int. *) (* Type classification functions *) -- cgit