Closed
Bug 487551
Opened 16 years ago
Closed 16 years ago
nsTArray.IndexOf may scan beyond array bounds for non-zero start argument
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
People
(Reporter: asuth, Assigned: asuth)
References
Details
(Keywords: fixed1.9.1)
Attachments
(2 files)
564 bytes,
patch
|
benjamin
:
review+
benjamin
:
approval1.9.1+
|
Details | Diff | Splinter Review |
797 bytes,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
The iterator and end-iterator are initialized like so:
const elem_type* iter = Elements() + start, *end = iter + Length();
Since the 'end' iterator is using Length(), it probably wants to be using Elements() too:
const elem_type* iter = Elements() + start, *end = Elements() + Length();
Ideally the fix could hit 1.9.1 as this causes Thunderbird to crash like described in (core/xpcom) bug 455216. We can work around the issue, but it would be nice not to have to.
unit test as next patch
Attachment #371785 -
Flags: review?(benjamin)
Flags: wanted1.9.1?
Assignee | ||
Comment 1•16 years ago
|
||
Here is a unit test. Obviously, a unit test that depends on data existing beyond the official bounds of the array is implementation-dependent.
Updated•16 years ago
|
Attachment #371785 -
Flags: review?(benjamin) → review+
Updated•16 years ago
|
Attachment #371786 -
Flags: review?(benjamin) → review+
Assignee | ||
Comment 3•16 years ago
|
||
These landed in mozilla-central on friday, but I forgot to hit submit:
fix pushed: http://hg.mozilla.org/mozilla-central/rev/ed0e7eabef8f
unit test pushed: http://hg.mozilla.org/mozilla-central/rev/730004d7878c
It does not appear that I have the privileges required to request approval1.9.1. davida/dmose/bienvenu, maybe you can do that?
(In reply to comment #2)
> are there any security concerns w/ this bug?
I doubt there are exploitable security impacts from this bug; I would expect mainly potential crashers and memory corruption in cases where the indexOf is speculative.
However, it's a ridiculously safe fix for an arguably serious correctness issue, which is why it should be allowed in 1.9.1.
Flags: in-testsuite+
Assignee | ||
Comment 4•16 years ago
|
||
Er, and fixed on trunk.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Comment 5•16 years ago
|
||
Comment on attachment 371785 [details] [diff] [review]
base 'end' off of Elements rather than iter.
requesting approval for 1.9.1
Attachment #371785 -
Flags: approval1.9.1?
Updated•16 years ago
|
Attachment #371785 -
Flags: approval1.9.1? → approval1.9.1+
Comment 6•16 years ago
|
||
Comment on attachment 371785 [details] [diff] [review]
base 'end' off of Elements rather than iter.
Please land this with the unit test.
Assignee | ||
Comment 7•16 years ago
|
||
landed on 1.9.1:
fix: http://hg.mozilla.org/releases/mozilla-1.9.1/rev/0acd00851e60
unit test: http://hg.mozilla.org/releases/mozilla-1.9.1/rev/0ac64f9870d4
You need to log in
before you can comment on or make changes to this bug.
Description
•