This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/6453] New: scanf integer overflow handling different between 32bit and 64bit


Matthias Andre has reported to SUSE a difference in integer handling in scanf()
handling.

The attached testcase has different results for 32bit and 64bit mode, even 
though "int" is 32bit signed in both modes (x86_64 and ppc confirmed).

$ gcc -O2 -o foo foo.c -m32
$ ./foo
s="18446744073709551615", n=1, i=2147483647, errno=34/Numerical result out of 
range
s="4294967295", n=1, i=2147483647, errno=34/Numerical result out of range
s="2147483647", n=1, i=2147483647, errno=0/Success
$ gcc -O2 -o foo foo.c -m64
$ ./foo
s="18446744073709551615", n=1, i=-1, errno=34/Numerical result out of range
s="4294967295", n=1, i=-1, errno=0/Success
s="2147483647", n=1, i=2147483647, errno=0/Success
$


Expected: same output.

-- 
           Summary: scanf integer overflow handling different between 32bit
                    and 64bit
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: meissner at suse dot de
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: ppc-linux-gnu
  GCC host triplet: ppc-linux-gnu
GCC target triplet: ppc-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=6453

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]