public inbox for glibc-bugs-regex@sourceware.org
help / color / mirror / Atom feed
* [Bug regex/1286] portability bugs in comparing size_t versus in regex_internal code
2005-09-01 20:59 [Bug regex/1286] New: portability bugs in comparing size_t versus in regex_internal code eggert at gnu dot org
@ 2005-09-01 20:59 ` eggert at gnu dot org
2005-09-07 0:47 ` drepper at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: eggert at gnu dot org @ 2005-09-01 20:59 UTC (permalink / raw)
To: glibc-bugs-regex
------- Additional Comments From eggert at gnu dot org 2005-09-01 20:59 -------
Created an attachment (id=641)
--> (http://sources.redhat.com/bugzilla/attachment.cgi?id=641&action=view)
fix size_t vs int comparison glitches
--
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug regex/1286] New: portability bugs in comparing size_t versus in regex_internal code
@ 2005-09-01 20:59 eggert at gnu dot org
2005-09-01 20:59 ` [Bug regex/1286] " eggert at gnu dot org
2005-09-07 0:47 ` drepper at redhat dot com
0 siblings, 2 replies; 3+ messages in thread
From: eggert at gnu dot org @ 2005-09-01 20:59 UTC (permalink / raw)
To: glibc-bugs-regex
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug regex/1286] portability bugs in comparing size_t versus in regex_internal code
2005-09-01 20:59 [Bug regex/1286] New: portability bugs in comparing size_t versus in regex_internal code eggert at gnu dot org
2005-09-01 20:59 ` [Bug regex/1286] " eggert at gnu dot org
@ 2005-09-07 0:47 ` drepper at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: drepper at redhat dot com @ 2005-09-07 0:47 UTC (permalink / raw)
To: glibc-bugs-regex
------- Additional Comments From drepper at redhat dot com 2005-09-07 00:47 -------
I left out the cast to size_t. That's just ridiculous. size_t is always wide
enough to accomodate integer arithmetic.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://sourceware.org/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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-09-07 0:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-01 20:59 [Bug regex/1286] New: portability bugs in comparing size_t versus in regex_internal code eggert at gnu dot org
2005-09-01 20:59 ` [Bug regex/1286] " eggert at gnu dot org
2005-09-07 0:47 ` drepper at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).