Closed Bug 1487606 Opened 2 years ago Closed 2 years ago

AppendLiteral after SetCapacity() undoes the effect of SetCapacity()

Categories

(Core :: String, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: hsivonen, Assigned: hsivonen)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

When mLength == 0, AppendLiteral() ends up calling AssignLiteral(). This is bad if SetCapacity() was called before AppendLiteral() and the caller in good faith assumed that SetCapacity() before a sequence of appends is OK.

AppendLiteral() should not call AssignLiteral() if mLength == 0 and the string already has a shared buffer.
Blocks: 1487612
MozReview-Commit-ID: I2QSXbQhOUH
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED
Comment on attachment 9005583 [details]
Bug 1487606 - Make AppendLiteral() not undo the effect of SetCapacity().

Nathan Froyd [:froydnj] has approved the revision.
Attachment #9005583 - Flags: review+
Pushed by hsivonen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bf6f5ec86920
Make AppendLiteral() not undo the effect of SetCapacity(). r=froydnj
https://hg.mozilla.org/mozilla-central/rev/bf6f5ec86920
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.