mirror of https://github.com/google/oss-fuzz.git
35 lines
1.5 KiB
Diff
35 lines
1.5 KiB
Diff
|
From 3d8a80c4f3470fea0169f6774320e61619bac52b Mon Sep 17 00:00:00 2001
|
||
|
From: David Tardon <dtardon@redhat.com>
|
||
|
Date: Mon, 2 Oct 2017 16:22:36 +0200
|
||
|
Subject: [PATCH] ofz#2894 avoid signed integer overflow
|
||
|
|
||
|
/usr/include/boost/spirit/home/qi/numeric/detail/real_impl.hpp:86:48: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
|
||
|
---
|
||
|
include/boost/spirit/home/qi/numeric/detail/real_impl.hpp | 7 ++++---
|
||
|
1 file changed, 4 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/include/boost/spirit/home/qi/numeric/detail/real_impl.hpp b/include/boost/spirit/home/qi/numeric/detail/real_impl.hpp
|
||
|
index 9aa5bb8bb..3e7ab18a9 100644
|
||
|
--- a/include/boost/spirit/home/qi/numeric/detail/real_impl.hpp
|
||
|
+++ b/include/boost/spirit/home/qi/numeric/detail/real_impl.hpp
|
||
|
@@ -81,12 +81,13 @@ namespace boost { namespace spirit { namespace traits
|
||
|
detail::compensate_roundoff(n, acc_n);
|
||
|
n /= pow10<T>(-min_exp);
|
||
|
|
||
|
- // return false if (-exp + min_exp) exceeds the -min_exp
|
||
|
+ // return false if exp still exceeds the min_exp
|
||
|
// do this check only for primitive types!
|
||
|
- if (is_floating_point<T>() && (-exp + min_exp) > -min_exp)
|
||
|
+ exp += -min_exp;
|
||
|
+ if (is_floating_point<T>() && exp < min_exp)
|
||
|
return false;
|
||
|
|
||
|
- n /= pow10<T>(-exp + min_exp);
|
||
|
+ n /= pow10<T>(-exp);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
--
|
||
|
2.14.1
|
||
|
|