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/12527] New: Off by one bug with ftell() with fmemopen()


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

           Summary: Off by one bug with ftell() with fmemopen()
           Product: glibc
           Version: 2.12
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: per.mathisen@gmail.com


Created attachment 5269
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5269
Program that fails

The attached tiny program assert fails on ftell(fp) == ftell(fp), which it
seems to me should always work. I only get this problem with file pointers
created with fmemopen and the "r+" mode, and only with sequences of events
similar to those in the attached file. The ftell() seems to always returns 1
less than the actual size when it fails.

There also seems to be an issue with fmemopen() when used with the "r+" mode if
the input buffer is not zero cleared. See comment in attachment.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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