Closed Bug 340595 Opened 19 years ago Closed 19 years ago

Bug in nsTArray::SetLength

Categories

(Core :: XPCOM, defect)

1.8 Branch
All
Linux
defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: brettw, Assigned: brettw)

Details

(Keywords: fixed1.8.1)

Attachments

(1 file)

PRBool SetLength(size_type newLen) { size_type oldLen = Length(); if (newLen > oldLen) { SetCapacity(newLen); // Check for out of memory conditions if (Capacity() != newLen) <-- return PR_FALSE; // Initialize the extra array elements ... On the marked line, if the capacity does not equal the requested length, resizing fails. However, the capacity increasing algorithm uses doubling, making this test fail most of the time even when capacity succeeds because the capacity might be larger than the requested size. Patch forthcoming.
Attached patch PatchSplinter Review
Attachment #224632 - Flags: review?(darin)
Attachment #224632 - Flags: approval-branch-1.8.1?(darin)
Comment on attachment 224632 [details] [diff] [review] Patch thanks! r+a=darin
Attachment #224632 - Flags: review?(darin)
Attachment #224632 - Flags: review+
Attachment #224632 - Flags: approval-branch-1.8.1?(darin)
Attachment #224632 - Flags: approval-branch-1.8.1+
Fixed on trunk and 1.8 branch.
Status: NEW → RESOLVED
Closed: 19 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: