Summary: | scanf %f doesn't parse "0e+0" correctly | ||
---|---|---|---|
Product: | glibc | Reporter: | Adam Sampson <ats-sourceware> |
Component: | stdio | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bugdal, erik |
Priority: | P2 | Flags: | fweimer:
security-
|
Version: | 2.18 | ||
Target Milestone: | 2.19 | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Adam Sampson
2013-08-31 23:22:08 UTC
Erm, it should reject something like 0x.e+0 as nonsense, that is. 0xe+0 isn't nonsense! I'm confused why this issue even happened, since parsing of hex floats should be completely separate from parsing of decimal floats (the allowed forms are sufficiently different, not to mention the computations to compute the values to store). I guess the leading 0 is already eaten before it's determined that the input is not hex. Anyway, 0xe+0 is not nonsense, but parsing of course should stop just before the plus sign. Also, it should be noted that 0x.e+0 is invalid for scanf but valid for strtod (here, strtod only reads the first character). 0x.e+0 is as valid as 0xe+0, with the subject sequence being "0x.e". Indeed, I missed that. My own implementation agrees with you, as does the specification, of course. Fixed by a4966c6. On Thu, Oct 31, 2013 at 11:58:59AM +0000, schwab@linux-m68k.org wrote: > Resolution|--- |FIXED Awesome -- thanks very much. :) |