Crash in [@ mozilla::image::`anonymous namespace'::ImageDecoderListener::GetFrame]
Categories
(Core :: Audio/Video: Playback, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr68 | --- | unaffected |
firefox-esr78 | --- | unaffected |
firefox77 | --- | unaffected |
firefox78 | --- | unaffected |
firefox79 | --- | fixed |
firefox80 | --- | fixed |
People
(Reporter: calixte, Assigned: alwu)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: crash, regression)
Crash Data
Attachments
(2 files)
(deleted),
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
|
Details |
(deleted),
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
|
Details |
This bug is for crash report bp-2eebee1b-c43e-49c5-ad26-f18ba0200619.
Top 10 frames of crashing thread:
0 xul.dll mozilla::image::`anonymous namespace'::ImageDecoderListener::GetFrame image/imgTools.cpp:144
1 xul.dll mozilla::image::imgTools::EncodeImage image/imgTools.cpp:474
2 xul.dll WindowsSMTCProvider::LoadImageAtIndex::<unnamed-tag>::operator const widget/windows/WindowsSMTCProvider.cpp:464
3 xul.dll mozilla::MozPromise<nsCOMPtr<imgIContainer>, bool, 1>::ThenValue<`lambda at /builds/worker/checkouts/gecko/widget/windows/WindowsSMTCProvider.cpp:452:11', `lambda at /builds/worker/checkouts/gecko/widget/windows/WindowsSMTCProvider.cpp:475:11'>::DoResolveOrRejectInternal xpcom/threads/MozPromise.h:769
4 xul.dll mozilla::MozPromise<CopyableTArray<bool>, nsresult, 0>::ThenValueBase::ResolveOrRejectRunnable::Run xpcom/threads/MozPromise.h:410
5 xul.dll mozilla::AutoTaskDispatcher::TaskGroupRunnable::Run xpcom/threads/TaskDispatcher.h:228
6 xul.dll nsThread::ProcessNextEvent xpcom/threads/nsThread.cpp:1234
7 xul.dll NS_ProcessNextEvent xpcom/threads/nsThreadUtils.cpp:501
8 xul.dll mozilla::ipc::MessagePump::Run ipc/glue/MessagePump.cpp:87
9 xul.dll MessageLoop::RunHandler ipc/chromium/src/base/message_loop.cc:308
There are 7 crashes (from 4 installations) in nightly 79 starting with buildid 20200619092144. In analyzing the backtrace, the regression may have been introduced by patch [1] to fix bug 1623971.
[1] https://hg.mozilla.org/mozilla-central/rev?node=b57d9a939f73
Reporter | ||
Updated•4 years ago
|
Comment 1•4 years ago
|
||
It looks like it's a UAF. Since the crash occurs at here
NS_IMETHOD_(already_AddRefed<mozilla::gfx::SourceSurface>)
GetFrame(uint32_t aWhichFrame, uint32_t aFlags) override {
return mImage->GetFrame(aWhichFrame, aFlags);
}
(The macro is expanded by NS_FORWARD_IMGICONTAINER(mImage->)
), when encoding the image at here.
I guess the reason is mImage
is a nullptr
. When OnImageReady
is called, the given imgIContainer
may have a null mImage
so mImage->
would cause a UAF.
Comment 2•4 years ago
|
||
agi, is there a way to detect whether mImage
is set or not when OnImageReady
is fired? Can I use SIZE_AVAILABLE
as an indicator to see if mImage
is set?
Comment 3•4 years ago
|
||
I think aosmond is better equipped to answer this question :)
Comment 4•4 years ago
|
||
FYI the code linked above doesn't run in the case of the stacktrace in this bug, from what I can see. It's only used when calling DecodeImageFromChannelAsync
, although it might be relevant for more code paths.
EDIT: ah nevermind it's actually hitting this. That's interesting.
Comment 5•4 years ago
|
||
From what I can see mImage
should always be non-null if the download was completed successfully, and it looks like if you're in the HandleFetchSuccess
code path that should always be true.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 7•4 years ago
|
||
The assertions we add in HandleFetchSuccess()
are debug-only, so they might not be triggled on an offical Nightly build.
It seems that we might get a null image when (1) we encouter an error during fetching or (2) there is no data from the URL from which we requested an image. In the second situation, I guess the aStatus
might still be a success (and OnDataAvailable()
wasn't called) and we should not set the pointer of the image container ar that time if we don't have mImage
yet.
Assignee | ||
Comment 8•4 years ago
|
||
It's possible only OnStartRequest()
and OnStopRequest()
was called, but no OnDataAvailable()
. If so, when OnStopRequest()
is being called, we would have no image but the channel status is a success.
Therefore, before setting the image container, we should also ensure we get the image already.
Assignee | ||
Comment 9•4 years ago
|
||
The image container might be null, so we should handle this case properly as a fail case.
Updated•4 years ago
|
Comment 10•4 years ago
|
||
Comment 11•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/21576931d335
https://hg.mozilla.org/mozilla-central/rev/c979b29463be
Comment 12•4 years ago
|
||
The patch landed in nightly and beta is affected.
:alwu, is this bug important enough to require an uplift?
If not please set status_beta
to wontfix
.
For more information, please visit auto_nag documentation.
Assignee | ||
Comment 13•4 years ago
|
||
Comment on attachment 9158703 [details]
Bug 1647070 - part1 : set container only when we have an image and no error occurs.
Beta/Release Uplift Approval Request
- User impact if declined: users might encouter a crash when using media control on certain sites.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: No
- If yes, steps to reproduce: No
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): In these changes, we add some additional check to avoid from dereferencing a null pointer, which is no harm at all.
- String changes made/needed: No
Assignee | ||
Updated•4 years ago
|
Comment 14•4 years ago
|
||
Comment on attachment 9158703 [details]
Bug 1647070 - part1 : set container only when we have an image and no error occurs.
Approved for 79.0b5.
Updated•4 years ago
|
Comment 15•4 years ago
|
||
bugherder uplift |
Updated•4 years ago
|
Description
•