mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
fix potential overflow in exponent reading
note that there's no need for a precise cutoff, because exponents this large will always result in overflow or underflow (it's impossible to read enough digits to compensate for the exponent magnitude; even at a few nanoseconds per digit it would take hundreds of years).
This commit is contained in:
parent
c5ff29699c
commit
633a26c1e6
1 changed files with 1 additions and 1 deletions
|
@ -44,7 +44,7 @@ static long long scanexp(FILE *f, int pok)
|
|||
}
|
||||
for (x=0; c-'0'<10U && x<INT_MAX/10; c = shgetc(f))
|
||||
x = 10*x + c-'0';
|
||||
for (y=x; c-'0'<10U && x<LLONG_MAX/10; c = shgetc(f))
|
||||
for (y=x; c-'0'<10U && x<LLONG_MAX/100; c = shgetc(f))
|
||||
y = 10*y + c-'0';
|
||||
for (; c-'0'<10U; c = shgetc(f));
|
||||
shunget(f);
|
||||
|
|
Loading…
Add table
Reference in a new issue