This is the mail archive of the glibc-bugs-regex@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 regex/1286] New: portability bugs in comparing size_t versus in regex_internal code


The regex_internal code assigns the result of mbrtowc to an int
variable, but this has undefined behavior if (size_t) -1 cannot be
represented as an int.

Less importantly, the code compares X + 2 > 2 where X is of type
size_t, but this doesn't have the desired behavior in the (admittedly
very unlikely) case where size_t is narrower than int, since in that
case the comparison is signed rather than unsigned.

I'll attach a patch.

-- 
           Summary: portability bugs in comparing size_t versus in
                    regex_internal code
           Product: glibc
           Version: 2.3.5
            Status: NEW
          Severity: normal
          Priority: P2
         Component: regex
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: eggert at gnu dot org
                CC: glibc-bugs-regex at sources dot redhat dot com,glibc-
                    bugs at sources dot redhat dot com


http://sources.redhat.com/bugzilla/show_bug.cgi?id=1286

------- 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]