Closed
Bug 340595
Opened 19 years ago
Closed 19 years ago
Bug in nsTArray::SetLength
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: brettw, Assigned: brettw)
Details
(Keywords: fixed1.8.1)
Attachments
(1 file)
1.08 KB,
patch
|
darin.moz
:
review+
darin.moz
:
approval-branch-1.8.1+
|
Details | Diff | Splinter Review |
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.
Assignee | ||
Comment 1•19 years ago
|
||
Attachment #224632 -
Flags: review?(darin)
Attachment #224632 -
Flags: approval-branch-1.8.1?(darin)
Comment 2•19 years ago
|
||
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+
Assignee | ||
Comment 3•19 years ago
|
||
Fixed on trunk and 1.8 branch.
You need to log in
before you can comment on or make changes to this bug.
Description
•