Closed Bug 324981 Opened 20 years ago Closed 20 years ago

nsTArray crash in RemoveElement

Categories

(Core :: XPCOM, defect)

x86
Linux
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: brettw, Assigned: darin.moz)

Details

(Keywords: fixed1.8.1)

Attachments

(1 file)

RemoveElement will crash when the element is not found. It compares the result of IndexOf with >= 0, but the type is UInt, so it will always be true. You want to compare it to NoIndex to test for failure. Testcase: nsTArray<int> foo; foo.RemoveElement(5); I'd fix this myself but I'm unsure what branches this would need to be checked into, etc.
No worries. I've got it.
Severity: normal → critical
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.9alpha
Attached patch v1 patchSplinter Review
Attachment #209921 - Flags: review?(benjamin)
Attachment #209921 - Flags: review?(benjamin)
Attachment #209921 - Flags: review+
Attachment #209921 - Flags: approval1.8.1+
fixed-on-trunk
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
fixed1.8.1
Keywords: fixed1.8.1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: