Closed
Bug 1170274
Opened 11 years ago
Closed 11 years ago
Memory-safety bug in nsGenericHTMLElement::GetURIListAttr
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla41
| Tracking | Status | |
|---|---|---|
| firefox41 | --- | fixed |
People
(Reporter: q1, Assigned: baku)
Details
(Keywords: sec-other, Whiteboard: [post-critsmash-triage][adv-main41-])
Attachments
(1 file, 2 obsolete files)
|
2.62 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0
Build ID: 20150305021524
Steps to reproduce:
nsGenericHTMLElement::GetURIListAttr (38.0.1\dom\html\nsGenericHTMLElement.cpp) can reference memory that it does not own, dereferencing an iterator that could == end without first checking.
The bug is on line 1739:
1739: while (*start == ' ' && start < iter)
1740 ++start;
If the string "value" is empty, start == iter == end, and *start examines memory that the function does not own.
As far as I can tell from examining the rest of the function, the worst consequence of this bug is a crash, but I am tagging this as a security bug because I could have missed something that would cause a problem.
Updated•11 years ago
|
Component: Untriaged → DOM
Product: Firefox → Core
Comment 1•11 years ago
|
||
start should be a pointer to gNullChar and gNullChar is 0.
| Assignee | ||
Comment 2•11 years ago
|
||
Assignee: nobody → amarchesini
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #8621000 -
Flags: review?(ehsan)
Comment 3•11 years ago
|
||
Comment on attachment 8621000 [details] [diff] [review]
crash7.patch
Review of attachment 8621000 [details] [diff] [review]:
-----------------------------------------------------------------
Here I would also like to see a proper tokenizer (perhaps using NS_strtok -- I think that should be enough here...)
Attachment #8621000 -
Flags: review?(ehsan) → review-
| Assignee | ||
Comment 4•11 years ago
|
||
Attachment #8621000 -
Attachment is obsolete: true
Attachment #8622425 -
Flags: review?(ehsan)
Comment 5•11 years ago
|
||
Comment on attachment 8622425 [details] [diff] [review]
crash7.patch
Review of attachment 8622425 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/html/nsGenericHTMLElement.cpp
@@ +1736,5 @@
> + char* buffer = str.BeginWriting();
> +
> + while (char* token = NS_strtok(" ", &buffer)) {
> + if (!aResult.IsEmpty()) {
> + aResult.Append(NS_LITERAL_STRING(" "));
Nit: couldn't you leave this as |aResult.Append(char16_t(' '));|?
Attachment #8622425 -
Flags: review?(ehsan) → review+
| Assignee | ||
Comment 6•11 years ago
|
||
Attachment #8622425 -
Attachment is obsolete: true
| Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 7•11 years ago
|
||
This needs a security rating before it can land. Andrea, do you agree with comment 0 that says this does not seem like a security issue and this is just a crash? In that case we can rate this sec-other and it can land.
Flags: needinfo?(amarchesini)
Updated•11 years ago
|
Keywords: checkin-needed
| Assignee | ||
Comment 8•11 years ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #7)
> This needs a security rating before it can land. Andrea, do you agree with
> comment 0 that says this does not seem like a security issue and this is
> just a crash? In that case we can rate this sec-other and it can land.
Yes, I agree. We can rate it sec-other.
Flags: needinfo?(amarchesini)
| Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 9•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/e44f689c3756
Is this worth backporting?
| Assignee | ||
Comment 10•11 years ago
|
||
It's not sec-critical. I think we can avoid the backporting for this patch. ehsan?
Flags: needinfo?(amarchesini) → needinfo?(ehsan)
Comment 11•11 years ago
|
||
Backed out for reflection-embedded.html w-p-t failures.
https://treeherder.mozilla.org/logviewer.html#?job_id=10826031&repo=mozilla-inbound
https://hg.mozilla.org/integration/mozilla-inbound/rev/85f92f328b52
| Assignee | ||
Comment 12•11 years ago
|
||
ehsan, we cannot use NS_strtok. Can we go back to my previous patch?
Flags: needinfo?(ehsan)
Comment 13•11 years ago
|
||
(In reply to Andrea Marchesini (:baku) from comment #12)
> ehsan, we cannot use NS_strtok. Can we go back to my previous patch?
Why not?
| Assignee | ||
Comment 14•11 years ago
|
||
Comment on attachment 8621000 [details] [diff] [review]
crash7.patch
Review of attachment 8621000 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/html/nsGenericHTMLElement.cpp
@@ +1753,5 @@
> + ++iter;
> + }
> +
> + if (!aResult.IsEmpty()) {
> + aResult.Append(NS_LITERAL_STRING(" "));
aResult.Append(char16_t(' '));
| Assignee | ||
Comment 15•11 years ago
|
||
Comment on attachment 8621000 [details] [diff] [review]
crash7.patch
\0 is a valid char in html5, not a EOS.
Attachment #8621000 -
Flags: review- → review?(ehsan)
| Assignee | ||
Updated•11 years ago
|
Attachment #8622532 -
Attachment is obsolete: true
| Assignee | ||
Updated•11 years ago
|
Attachment #8621000 -
Attachment is obsolete: false
Updated•11 years ago
|
Attachment #8621000 -
Flags: review?(ehsan) → review+
| Assignee | ||
Comment 16•11 years ago
|
||
| Assignee | ||
Comment 17•11 years ago
|
||
| Assignee | ||
Comment 18•11 years ago
|
||
Comment 19•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/1da97e961c3d
https://hg.mozilla.org/mozilla-central/rev/b55daa813afd
Status: NEW → RESOLVED
Closed: 11 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Updated•10 years ago
|
Whiteboard: [post-critsmash-triage]
Updated•10 years ago
|
Group: core-security → core-security-release
Updated•10 years ago
|
Whiteboard: [post-critsmash-triage] → [post-critsmash-triage][adv-main41-]
Updated•10 years ago
|
Group: core-security-release
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•