Closed
Bug 108067
Opened 23 years ago
Closed 20 years ago
Missing null pointer check in nsScanner::RewindToMark()
Categories
(Core :: DOM: HTML Parser, defect)
Core
DOM: HTML Parser
Tracking
()
RESOLVED
FIXED
People
(Reporter: c, Assigned: mrbkap)
References
Details
Attachments
(3 files, 1 obsolete file)
(deleted),
patch
|
harishd
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
nsScanner::RewindToMark() doesn't check if mSlidingBuffer is initialized.
This causes bug 107945 and bug 107994.
Reporter | ||
Comment 1•23 years ago
|
||
Reporter | ||
Updated•23 years ago
|
Attachment #56136 -
Flags: review+
Reporter | ||
Comment 4•23 years ago
|
||
If we do so, we can fix another bug in nsScanner::UngetReadable() with
mCountRemaining not being updated (should have filed a separate bug for that,
but I saw no actual problem with it in the trunk).
BTW, why does nsScanner::UngetReadable() return a PR_BOOL? I assume PR_TRUE
means success and PR_FALSE failure.
Reporter | ||
Comment 5•23 years ago
|
||
Reporter | ||
Comment 6•23 years ago
|
||
Found another function where mCurrentPosition and mEndPosition might be
undefined: CopyUnusedData().
Reporter | ||
Comment 7•23 years ago
|
||
Reporter | ||
Updated•23 years ago
|
Attachment #56153 -
Attachment is obsolete: true
Should we try to get this reviewed & checked in? We could then also remove at
least one hack (nsParser.cpp line 2435-2439).
Assignee | ||
Comment 9•20 years ago
|
||
It seems like most of the problems that this bug would have fixed are fixed by
bug 182067. With that fix in, I think anybody who tries to do anything usefull
with a scanner with no data will get eof (i.e., reading the next char). I can
create an updated patch with the rest of the functions null-checked, but I can't
imagine why or how anybody would want to UngetReadable (or RewindToMark, etc.)
on an empty buffer (where would they unget from? They would have started at eof).
Also note: CopyUnusedData would no longer need an explicit null-check, except to
avoid the function call, because for an empty scanner we guarentee
mCurPosition==mEndPosition.
Comment 10•20 years ago
|
||
Well.. we don't need to do anything _useful_ on those calls. But unless the API
explicitly prohibits them, we shouldn't crash....
Assignee | ||
Comment 11•20 years ago
|
||
This patch adds null-checks to all functions accessing mSlidingBuffer. The only
difference of any note between it and the current one is that I haven't
bothered updating the javadoc comments, as they're all so out of date anyway.
Assignee | ||
Comment 12•20 years ago
|
||
Comment on attachment 149796 [details] [diff] [review]
updated patch
bz, could you give this review and check it in please?
Attachment #149796 -
Flags: superreview?(bzbarsky)
Attachment #149796 -
Flags: review?(bzbarsky)
Comment 13•20 years ago
|
||
Comment on attachment 149796 [details] [diff] [review]
updated patch
r+sr=bzbarsky
Attachment #149796 -
Flags: superreview?(bzbarsky)
Attachment #149796 -
Flags: superreview+
Attachment #149796 -
Flags: review?(bzbarsky)
Attachment #149796 -
Flags: review+
Updated•20 years ago
|
Assignee: c → mrbkap
Status: ASSIGNED → NEW
Comment 14•20 years ago
|
||
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.
Description
•