Closed
Bug 190879
Opened 22 years ago
Closed 13 years ago
FindChar() should assert and return kNotFound if called with offset > string length
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: sspitzer, Assigned: jag+mozilla)
Details
FindChar() should assert and return kNotFound if called with offset > string length see http://bugzilla.mozilla.org/show_bug.cgi?id=187065 for an example of this. of course, callers shouldn't be doing this. but can we add some code to assert and bail on this?
Assignee | ||
Comment 1•22 years ago
|
||
Should that code be debug only? I'd rather we fix all callers than burden everyone with this check.
Updated•15 years ago
|
QA Contact: scc → string
Comment 2•13 years ago
|
||
I checked and found that all the string (nsTSubstring.cpp, nsStringAPI.cpp) are checking for offset < length and are returning -1 (kNotFound) if found. http://mxr.mozilla.org/mozilla-central/source/xpcom/string/src/nsTSubstring.cpp#675 http://mxr.mozilla.org/mozilla-central/source/xpcom/glue/nsStringAPI.cpp#875 I guess this bug has been fixed and hence marking it as Resolved/WorksForMe.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
Comment 3•13 years ago
|
||
Feel free to open in case you found the problem in the existing code (which I missed).
Updated•3 years ago
|
Component: String → XPCOM
You need to log in
before you can comment on or make changes to this bug.
Description
•