Crash [@ mozilla::net::nsHttpHandler::AsyncOnChannelRedirect]
Categories
(Core :: Networking: HTTP, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox70 | --- | affected |
People
(Reporter: decoder, Unassigned)
References
Details
(Keywords: crash, testcase, Whiteboard: [necko-triaged])
Crash Data
Attachments
(3 files)
The attached testcase crashes on mozilla-central revision 20190729-50df4b75c9b6 (build with (buildFlags not available)).
For detailed crash information, see attachment.
To reproduce the issue, perform the following steps:
- Download the attached testcase, save as "test.bin".
2a. Build with --enable-fuzzing (requires Clang and ASan, also build gtests using./mach gtest dontruntests).
2b. Alternatively you can download builds from TC usingpython -mfuzzfetch -a --fuzzing --tests gtest(see https://github.com/MozillaSecurity/fuzzfetch). - Run MOZ_RUN_GTEST=1 LIBFUZZER=1 FUZZER=NetworkHttp objdir/dist/bin/firefox test.bin
| Reporter | ||
Comment 1•6 years ago
|
||
| Reporter | ||
Comment 2•6 years ago
|
||
Updated•6 years ago
|
Comment 3•6 years ago
|
||
Hello :decoder,
Did the crash happen on the non-debug build?
Looks like we have an assertion which is not triggered.
Comment 4•6 years ago
|
||
I can verify this crashes the parent process on a non-debug nightly build.
https://crash-stats.mozilla.org/report/index/4291f978-d810-4c32-8dc5-782040190801
| Reporter | ||
Comment 5•6 years ago
|
||
(In reply to Junior [:junior] from comment #3)
Hello :decoder,
Did the crash happen on the non-debug build?
Looks like we have an assertion which is not triggered.
Correct, this fuzzing target is currently not running on debug builds. Builds are non-debug optimized ASan.
Comment 6•6 years ago
|
||
Cool. That makes senses.
Thanks, :decoder and :freddyb.
Well, the crashed object is only for telemetry.
I can do a null-check and leave the assertion since we're expecting we have one url.
| Reporter | ||
Comment 7•6 years ago
|
||
I can make a patch for this that just null-checks newURI in nsHttpHandler::AsyncOnChannelRedirect. However, I would like to confirm that it is expected in this case that this function gets a channel that has no URI associated. If that isn't case, then there might be a bug deeper in the code somewhere.
:junior, can you answer this? If not, feel free to forward the needinfo to e.g. :dragana.
Comment 8•6 years ago
|
||
I would say it's not expected, but dragana might have some insight.
Updated•6 years ago
|
Comment 9•6 years ago
|
||
We crash here: https://hg.mozilla.org/mozilla-central/file/50df4b75c9b6/netwerk/protocol/http/nsHttpHandler.cpp#l836
nsresult nsHttpHandler::AsyncOnChannelRedirect(
nsIChannel* oldChan, nsIChannel* newChan, uint32_t flags,
nsIEventTarget* mainThreadEventTarget) {
MOZ_ASSERT(NS_IsMainThread() && (oldChan && newChan));
nsCOMPtr<nsIURI> newURI;
newChan->GetURI(getter_AddRefs(newURI));
MOZ_ASSERT(newURI);
nsAutoCString scheme;
newURI->GetScheme(scheme); <----
that is definitely very unexpected.
| Reporter | ||
Comment 10•6 years ago
|
||
I cannot reproduce this in local builds but it reproduces cleanly on TC builds. Here is the log, it looks like we do a redirect to a "view-source:" URI and then the new channel doesn't have a URI so newURI remains empty.
Since the newURI is only used to gather Telemetry on the redirect scheme, I can fix this crash by null-checking newURI and only send Telemetry if we actually have a new URI.
Honza, does that sound like the correct action here or do we expect the new channel to have the URI in any case, even for this weird "view-source:" redirect?
Comment 11•6 years ago
|
||
P2 as this is reproducible and show a weakness. I don't understand why this is not deterministic. In the log I can see we don't correctly process the response in the transaction (logan doesn't see it, there are just sparse nsHttpTransaction::ParseLine calls). If the new channel doesn't have a URI (a totally unexpected thing) it means it has been ill-constructed and we are not properly checking all error results somewhere.
Comment 12•6 years ago
|
||
(In reply to Christian Holler (:decoder) from comment #10)
Honza, does that sound like the correct action here or do we expect the new channel to have the URI in any case, even for this weird "view-source:" redirect?
Every channel must have a URI set.
Updated•3 years ago
|
Comment 14•2 years ago
|
||
I think we no longer crash on this one, right?
We might still hit the assertion though.
Updated•6 months ago
|
Description
•