Closed Bug 1343302 Opened 4 years ago Closed 4 years ago

Explicitly pass the nsHttpChannel to mCacheOpenRunnable instead of using a closure

Categories

(Core :: Networking: HTTP, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox-esr45 --- unaffected
firefox51 --- unaffected
firefox52 --- unaffected
firefox-esr52 --- unaffected
firefox53 --- unaffected
firefox54 --- fixed

People

(Reporter: nika, Assigned: nika)

References

Details

Attachments

(1 file, 1 obsolete file)

This breaks the analysis which I'm trying to land on central in bug 1336510.
MozReview-Commit-ID: 2jPiUdI1DWN
Attachment #8842094 - Flags: review?(valentin.gosu)
Comment on attachment 8842094 [details] [diff] [review]
Explicitly pass the nsHttpChannel to mCacheOpenRunnable instead of using a closure

Review of attachment 8842094 [details] [diff] [review]:
-----------------------------------------------------------------

::: netwerk/protocol/http/nsHttpChannel.cpp
@@ +8685,3 @@
>      mCacheOpenDelay = 0;
> +    mCacheOpenFunc(this);
> +    mCacheOpenFunc = nullptr;

Try this instead so we avoid any potential reentracy issues:
std::function<void(nsHttpChannel*)> localFunction = nullptr;
std::swap(localFunction, mCacheOpenFunc);
localFunction(this); // This will call AsyncOpenURI triggering the cache fetch
Attachment #8842094 - Flags: review?(valentin.gosu) → review+
Attachment #8842094 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/c92dc508b3b5
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Group: core-security → core-security-release
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.