|
From: | Markus Mützel |
Subject: | [Octave-bug-tracker] [bug #59094] Possible integer overflow in __ode15__.cc |
Date: | Sat, 19 Sep 2020 07:24:30 -0400 (EDT) |
User-agent: | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36 Edg/85.0.564.51 |
Update of bug #59094 (project octave): Status: None => Patch Submitted _______________________________________________________ Follow-up Comment #2: The attached patch adds functions that check whether multiplication of two "similar" integers would overflow. These functions wrap around macros provided by gnulib's `intprops` module. It also adds the necessary check to `__ode15__.cc`. The rules for integer multiplication between "dis-similar" integers and for function dispatching in C++ might differ (I haven't checked). But imho it would make code easier to understand (and possibly avoid unintended behavior) if we explicitly casted to a common integer type before such kinds of operation anyway. So I don't think it is necessary to add functions that check integer overflow on operations between "dis-similar" types (like "int type" times "unsigned long int type"). If needed, we could add similar check functions for other potentially critical operations. Checks are provided by gnulib for: * addition * subtraction * negation * multiplication * division * remainder * left shift See also: https://www.gnu.org/software/gnulib/manual/html_node/Integer-Type-Overflow.html#Integer-Type-Overflow Adding jwe to CC because he made the original proposition. (file #49819) _______________________________________________________ Additional Item Attachment: File name: bug59094_ode15_integer_overflow.patch Size:9 KB <https://file.savannah.gnu.org/file/bug59094_ode15_integer_overflow.patch?file_id=49819> _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?59094> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
[Prev in Thread] | Current Thread | [Next in Thread] |