mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-26 09:18:56 +00:00
Fix undefined behavior (signed integer overflow) when Clang parses a hexfloat with an enormous exponent. Caught by an existing unit test + -ftrapv.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162505 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -196,8 +196,10 @@ totalExponent(StringRef::iterator p, StringRef::iterator end,
|
|||||||
assert(value < 10U && "Invalid character in exponent");
|
assert(value < 10U && "Invalid character in exponent");
|
||||||
|
|
||||||
unsignedExponent = unsignedExponent * 10 + value;
|
unsignedExponent = unsignedExponent * 10 + value;
|
||||||
if (unsignedExponent > 32767)
|
if (unsignedExponent > 32767) {
|
||||||
overflow = true;
|
overflow = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exponentAdjustment > 32767 || exponentAdjustment < -32768)
|
if (exponentAdjustment > 32767 || exponentAdjustment < -32768)
|
||||||
|
Reference in New Issue
Block a user