BUG/MINOR: sample: Fix wrong overflow detection in add/sub conveters
When "add" or "sub" conveters are used, an overflow detection is performed.
When 2 negative integers are added (or a positive integer is substracted to
a positive one), we take care to not exceed the low limit (LLONG_MIN) and
when 2 positive integers are added, we take care to not exceed the high
limit (LLONG_MAX).
However, because of a missing 'else' statement, if there is no overflow in
the first case, we fall back on the second check (the one for positive adds)
and LLONG_MAX is returned. It means that most of time, when 2 negative
integers are added (or a positive integer is substracted to a negative one),
LLONG_MAX is returned.
This patch should solve the issue #2216. It must be backported to all stable
versions.
(cherry picked from commit b982fc21770d433a2edfac1336974d289316b271)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit ca6bf9116496eb33aea314e593b576daa49d7331)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 09dbf401bf0f21f2e3819e13cdf456ed6ac94337)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 13db908de5732d143454c0df041060a8435df506)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed