Fixing bug 245930. Don't crash if attempting to replace data past the end of a string. r=dbaron@dbaron.org, sr=darin@meer.net
git-svn-id: svn://10.0.0.236/trunk@157612 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -426,6 +426,8 @@ nsTSubstring_CharT::Replace( index_type cutStart, size_type cutLength, const cha
|
||||
}
|
||||
}
|
||||
|
||||
cutStart = PR_MIN(cutStart, Length());
|
||||
|
||||
ReplacePrep(cutStart, cutLength, length);
|
||||
|
||||
if (length > 0)
|
||||
@@ -449,6 +451,8 @@ nsTSubstring_CharT::ReplaceASCII( index_type cutStart, size_type cutLength, cons
|
||||
}
|
||||
#endif
|
||||
|
||||
cutStart = PR_MIN(cutStart, Length());
|
||||
|
||||
ReplacePrep(cutStart, cutLength, length);
|
||||
|
||||
if (length > 0)
|
||||
@@ -467,6 +471,8 @@ nsTSubstring_CharT::Replace( index_type cutStart, size_type cutLength, const sub
|
||||
|
||||
size_type length = tuple.Length();
|
||||
|
||||
cutStart = PR_MIN(cutStart, Length());
|
||||
|
||||
ReplacePrep(cutStart, cutLength, length);
|
||||
|
||||
if (length > 0)
|
||||
|
||||
Reference in New Issue
Block a user