Closed
Bug 829858
Opened 13 years ago
Closed 13 years ago
Null dereference in nsHttpChannel::InitOfflineCacheEntry()
Categories
(Core :: Networking: HTTP, defect)
Tracking
()
RESOLVED
FIXED
mozilla21
People
(Reporter: mayhemer, Assigned: mayhemer)
References
Details
(Whiteboard: [qa-])
Crash Data
Attachments
(1 file)
1.04 KB,
patch
|
briansmith
:
review+
lsblakk
:
approval-mozilla-aurora+
lsblakk
:
approval-mozilla-beta+
bajaj
:
approval-mozilla-esr10-
bajaj
:
approval-mozilla-esr17+
lmandel
:
approval-mozilla-b2g18+
mayhemer
:
checkin+
|
Details | Diff | Splinter Review |
1.11 if (!mResponseHead || mResponseHead->NoStore()) {
1.12 + if (mResponseHead->NoStore()) {
1.13 + mOfflineCacheEntry->AsyncDoom(nullptr);
1.14 + }
1.15 +
1.16 CloseOfflineCacheEntry();
1.17
1.18 + if (mResponseHead->NoStore()) {
1.19 + return NS_ERROR_NOT_AVAILABLE;
1.20 + }
1.21 +
1.22 return NS_OK;
1.23 }
Clear as the day.
It's not the first time I'm seeing a serious issue went in via a tiny patch. The smaller, the more dangerous how people don't spot the problem (both devs and reviewers) !
Attachment #701390 -
Flags: review?(jduell.mcbugs)
Attachment #701390 -
Flags: approval-mozilla-b2g18?
![]() |
Assignee | |
Updated•13 years ago
|
Severity: normal → critical
Version: Trunk → 21 Branch
Updated•13 years ago
|
Attachment #701390 -
Flags: review?(jduell.mcbugs) → review+
![]() |
Assignee | |
Comment 2•13 years ago
|
||
Comment on attachment 701390 [details] [diff] [review]
v1
https://hg.mozilla.org/integration/mozilla-inbound/rev/620f2cbe08be
Attachment #701390 -
Flags: checkin+
![]() |
Assignee | |
Updated•13 years ago
|
status-b2g18:
--- → affected
status-firefox21:
--- → affected
Comment 3•13 years ago
|
||
Comment on attachment 701390 [details] [diff] [review]
v1
b2g18+ - Please land today.
Attachment #701390 -
Flags: approval-mozilla-b2g18? → approval-mozilla-b2g18+
Comment 4•13 years ago
|
||
The logic of the final code looks really strange, it's at least worth a comment, if it is meant to do what it's doing.
3612 if (!mResponseHead || mResponseHead->NoStore()) {
3613 if (mResponseHead && mResponseHead->NoStore()) {
3614 mOfflineCacheEntry->AsyncDoom(nullptr);
3615 }
3616
3617 CloseOfflineCacheEntry();
3618
3619 if (mResponseHead && mResponseHead->NoStore()) {
3620 return NS_ERROR_NOT_AVAILABLE;
3621 }
3622
3623 return NS_OK;
3624 }
if mResponseHead is null, we will go straight to CloseOfflineCacheEntry call at 3617. If it is not null, we will call mResponseHead->NoStore(), and if that returns true, we will call the same function again, then proceed with the CloseOfflineCacheEntry() on 3617.
Is this what's meant to happen? It's probably worth at least a comment in the code if the intent is to call mResponseHead->NoStore() twice in a row?
![]() |
Assignee | |
Comment 5•13 years ago
|
||
![]() |
Assignee | |
Updated•13 years ago
|
![]() |
Assignee | |
Comment 6•13 years ago
|
||
(In reply to Milan Sreckovic [:milan] from comment #4)
> The logic of the final code looks really strange, it's at least worth a
> comment, if it is meant to do what it's doing.
>
> 3612 if (!mResponseHead || mResponseHead->NoStore()) {
> 3613 if (mResponseHead && mResponseHead->NoStore()) {
> 3614 mOfflineCacheEntry->AsyncDoom(nullptr);
> 3615 }
> 3616
> 3617 CloseOfflineCacheEntry();
> 3618
> 3619 if (mResponseHead && mResponseHead->NoStore()) {
> 3620 return NS_ERROR_NOT_AVAILABLE;
> 3621 }
> 3622
> 3623 return NS_OK;
> 3624 }
>
> if mResponseHead is null, we will go straight to CloseOfflineCacheEntry call
> at 3617. If it is not null, we will call mResponseHead->NoStore(), and if
> that returns true, we will call the same function again, then proceed with
> the CloseOfflineCacheEntry() on 3617.
>
> Is this what's meant to happen? It's probably worth at least a comment in
> the code if the intent is to call mResponseHead->NoStore() twice in a row?
I don't understand the concern here. You mean we are calling that small inline function that will probably be optimized by the compiler too often?
Comment 7•13 years ago
|
||
Concern is a strong word for it, I'm just nit picking. It is probably not worth the time we're spending on this exchange, but let me give you the devil's advocate. From the point of view of somebody reading the code and trying to understand what the author wanted, this is a bit annoying. Is the intent to call NoStore() twice? Does it make a difference? The name "NoStore" doesn't give me a clue if it's an action "don't store" or a test "no need to store", so I now have to go to the definition of NoStore and double check what it does, if it has side-effects, what it means. It is not a bad thing for someone to have to do that, but it seems that reading the code requires more thought than it should. Doing the pointer and NoStore() check again after CloseOfflineCacheEntry() suggests that mResponseHead could be set or the result of NoStore() could change. That's probably worth a comment?
![]() |
Assignee | |
Comment 8•13 years ago
|
||
Milan, feel free to submit a patch.
Updated•13 years ago
|
Crash Signature: [@ mozilla::net::nsHttpChannel::InitOfflineCacheEntry()]
Comment 9•13 years ago
|
||
Assignee: nobody → honzab.moz
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
Comment 10•13 years ago
|
||
Comment on attachment 701390 [details] [diff] [review]
v1
[Approval Request Comment]
User impact if declined: Necessary for bug 761040 to be uplifted.
Testing completed (on m-c, etc.): on m-c as of today.
Risk to taking this patch (and alternatives if risky): Very low.
String or UUID changes made by this patch: none.
Attachment #701390 -
Flags: approval-mozilla-release?
Attachment #701390 -
Flags: approval-mozilla-beta?
![]() |
Assignee | |
Comment 11•13 years ago
|
||
The patch causing this bug is not on release channel. And you are not asking for approval to release on it either.
Comment 12•13 years ago
|
||
Comment on attachment 701390 [details] [diff] [review]
v1
Thanks for pointing out my mistake, Honza. I corrected the approval request flags.
Attachment #701390 -
Flags: approval-mozilla-release?
Attachment #701390 -
Flags: approval-mozilla-esr17?
Attachment #701390 -
Flags: approval-mozilla-esr10?
Attachment #701390 -
Flags: approval-mozilla-aurora?
Comment 13•13 years ago
|
||
Comment on attachment 701390 [details] [diff] [review]
v1
Approving for aurora/beta to go along with bug 761040
Attachment #701390 -
Flags: approval-mozilla-beta?
Attachment #701390 -
Flags: approval-mozilla-beta+
Attachment #701390 -
Flags: approval-mozilla-aurora?
Attachment #701390 -
Flags: approval-mozilla-aurora+
Updated•13 years ago
|
Comment 14•13 years ago
|
||
status-firefox-esr10:
--- → affected
status-firefox19:
--- → fixed
status-firefox20:
--- → affected
status-firefox-esr17:
--- → affected
Comment 15•13 years ago
|
||
(Also, this is in my queue to land on Aurora once it reopens)
Comment 16•13 years ago
|
||
Comment 17•13 years ago
|
||
Comment on attachment 701390 [details] [diff] [review]
v1
Approving for esr17 as bug 761040 was recently approved and the patch in this bug blocks bug 761040 .And since we will be updating our esr10 users to esr17 in the upcoming release, not approving on esr10.
Attachment #701390 -
Flags: approval-mozilla-esr17?
Attachment #701390 -
Flags: approval-mozilla-esr17+
Attachment #701390 -
Flags: approval-mozilla-esr10?
Attachment #701390 -
Flags: approval-mozilla-esr10-
Comment 18•13 years ago
|
||
Comment 19•13 years ago
|
||
Backed out along with bug 761040 for build bustage. Leaving the approval set for now since the bustage was caused by the other cset, not this one.
https://hg.mozilla.org/releases/mozilla-esr17/rev/cf989dcd7867
Comment 20•13 years ago
|
||
Is there something QA can do to verify this fix ?
Updated•13 years ago
|
Whiteboard: [qa?]
![]() |
Assignee | |
Comment 21•13 years ago
|
||
There is an automated test for bug 761040, there is nothing more to do to exercise the incriminated code.
qa-
Comment 22•13 years ago
|
||
Re-landed on esr17 (taking into account that some of the code changed here was removed in the re-landed esr17 patch).
https://hg.mozilla.org/releases/mozilla-esr17/rev/20f9b4b5b4d0
Comment 23•13 years ago
|
||
Backed out again due to problems with bug 761040.
https://hg.mozilla.org/releases/mozilla-esr17/rev/a886fbd0a66c
Comment 24•13 years ago
|
||
Comment 25•13 years ago
|
||
Backed out again for xpcshell failures. See bug 761040.
https://hg.mozilla.org/releases/mozilla-esr17/rev/6523fbbd93e5
Updated•13 years ago
|
Whiteboard: [qa?] → [qa-]
Comment 26•13 years ago
|
||
You need to log in
before you can comment on or make changes to this bug.
Description
•