Closed Bug 280386 Opened 20 years ago Closed 20 years ago

Add sanity checking to nsScanner::SetPosition()

Categories

(Core :: DOM: HTML Parser, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mrbkap, Assigned: mrbkap)

References

()

Details

Attachments

(1 file)

In the past month or so (especially after bryner's string changes), we've had a
few bugs pop up because of incorrect use of nsScanner::SetPosition(). In
general, these bugs are hard to catch (unless they trigger a crash) since the
most noticeable side effect of the bad calls are that the mCountRemaining member
variable becomes extremely large, leading to strange bugs (like bug 273085,
where Peek() was returning NS_OK, while giving a garbage result because it
relies on mCountRemaining).

I've added an assertion to the function that should catch most (if not all)
problems of this sort in an easier to spot place (when the bad call is made) as
opposed to the problem showing up in a random way down the line.
Attached patch Add an assertionSplinter Review
Attachment #172848 - Flags: superreview?(jst)
Attachment #172848 - Flags: review?(bzbarsky)
Comment on attachment 172848 [details] [diff] [review]
Add an assertion

r=bzbarsky
Attachment #172848 - Flags: review?(bzbarsky) → review+
Comment on attachment 172848 [details] [diff] [review]
Add an assertion

sr=jst
Attachment #172848 - Flags: superreview?(jst) → superreview+
Fix checked in.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: