Closed
Bug 385259
Opened 18 years ago
Closed 18 years ago
nsSelection.cpp relies on undefined behavior
Categories
(Core :: Layout, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: mrbkap, Assigned: mrbkap)
Details
Attachments
(1 file, 1 obsolete file)
|
554 bytes,
patch
|
MatsPalmgren_bugz
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
We have:
PRInt32 pad = clipRect.width >> 2;
if (pad <= 0)
But the second test relies on sign extension happening for >>, which is not specified in the C standard.
| Assignee | ||
Comment 1•18 years ago
|
||
This preserves the desired behavior.
Attachment #269145 -
Flags: superreview?(jst)
Attachment #269145 -
Flags: review?(jst)
Updated•18 years ago
|
Attachment #269145 -
Flags: superreview?(jst)
Attachment #269145 -
Flags: superreview+
Attachment #269145 -
Flags: review?(jst)
Attachment #269145 -
Flags: review+
Comment 2•18 years ago
|
||
But clipRect.width is surely non-negative at that point.
So the second test should just be pad==0, no?
| Assignee | ||
Comment 3•18 years ago
|
||
I'd rather still make the change to / 4 for clarity. The compiler will happily do the strength reduction for us in this case.
Attachment #269145 -
Attachment is obsolete: true
Attachment #269304 -
Flags: superreview?(jst)
Attachment #269304 -
Flags: review?(mats.palmgren)
Comment 4•18 years ago
|
||
Comment on attachment 269304 [details] [diff] [review]
With Mats' suggestion
Oh, either way is fine with me, I wasn't really objecting to
the first patch.
Attachment #269304 -
Flags: review?(mats.palmgren) → review+
Updated•18 years ago
|
Attachment #269304 -
Flags: superreview?(jst) → superreview+
| Assignee | ||
Comment 5•18 years ago
|
||
Fix checked into trunk.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Updated•18 years ago
|
Flags: in-testsuite-
You need to log in
before you can comment on or make changes to this bug.
Description
•