Red Hat Bugzilla – Bug 203919
sscanf - bad hex conversion value with sign bit set and %i conversion
Last modified: 2016-11-24 10:03:18 EST
Description of problem:
'sscanf' does not process hex (0x) values properly if the MSB (sign) bit is set
using "%i" conversion. I suspect that the conversion routines do not parse the
value as a hex bit pattern, but convert the value to decimal thus causing an
overflow condition. This would explain why the cases in question would return
the max positive value.
Version-Release number of selected component (if applicable):
test case attached.
Steps to Reproduce:
Compile and execute test case
Using this test case on x86_64 the sscanf works fine.
Created attachment 134817 [details]
sscanf test case
Please read the standard:
0XFFFFFF00 is not in range of the int type (INT_MIN .. INT_MAX), so INT_MAX
should be returned. If you want a negative number in hexadecimal notation,