Closed
Bug 9069
Opened 25 years ago
Closed 25 years ago
nsStr::RFindCharInSet loops forever if destination not found
Categories
(Core :: XPCOM, defect, P3)
Tracking
()
VERIFIED
FIXED
People
(Reporter: hjtoi-bugzilla, Assigned: rickg)
References
()
Details
(Whiteboard: [07301999] waiting to hear back from heikki@citec.fi)
The summary really says it all, but the reason is that we have an unsigned
integer that we are decrementing which means our loop will never terminate if a
searched character is not found.
PRInt32 nsStr::RFindCharInSet(const nsStr& aDest,const nsStr& aSet,PRBool
aIgnoreCase,PRUint32 anOffset) {
PRUint32 offset=aDest.mLength-anOffset; // <= unsigned!
PRInt32 thePos;
while(--offset>=0) { // <= offset can never be < 0!
PRUnichar theChar=GetCharAt(aDest,offset);
thePos=gRFindChars[aSet.mCharSize](aSet.mStr,aSet.mLength,0,theChar,aIgnoreCase)
;
if(kNotFound!=thePos)
return offset;
} //while
return kNotFound;
}
Also, the person fixing this bug should take a look at the usage of *int* and
*int32* in nsStr. My understanding is that we should use PRInt16/32!
Updated•25 years ago
|
Assignee: dp → rickg
This is fixed in my tree, and will land with my next update.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Updated•25 years ago
|
Whiteboard: [07301999] waiting to hear back from heikki@citec.fi
Reporter | ||
Comment 3•25 years ago
|
||
Marking verified.
Reporter | ||
Updated•25 years ago
|
Status: RESOLVED → VERIFIED
Reporter | ||
Comment 4•25 years ago
|
||
This is what vacation does to you: sloppiness. NOW it should be verified...
You need to log in
before you can comment on or make changes to this bug.
Description
•