Assertion failure: mResourceEntries.Length() <= mResourceTimingBufferSize, at /builds/worker/workspace/build/src/dom/performance/Performance.cpp:431

RESOLVED FIXED in Firefox 61

Status

()

defect
P3
normal
RESOLVED FIXED
Last year
4 months ago

People

(Reporter: jkratzer, Assigned: baku)

Tracking

(Blocks 1 bug, {assertion, testcase})

59 Branch
mozilla61
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(firefox-esr52 unaffected, firefox59 unaffected, firefox60 wontfix, firefox61 fixed)

Details

(Whiteboard: [fuzzblocker])

Attachments

(2 attachments)

Posted file trigger.html
Testcase found while fuzzing mozilla-central rev 38b3c1d03a59.  Testcase must be served up by a local webserver in order to trigger.

rax = 0x0000000000000000   rdx = 0x0000000000000000
rcx = 0x00007f79118852dd   rbx = 0x00007f78d577b000
rsi = 0x00007f7911b54770   rdi = 0x00007f7911b53540
rbp = 0x00007ffef1533a00   rsp = 0x00007ffef15339d0
r8 = 0x00007f7911b54770    r9 = 0x00007f7912c1e740
r10 = 0x0000000000000039   r11 = 0x0000000000000000
r12 = 0x00007ffef1533ab8   r13 = 0x00007ffef1533a18
r14 = 0x00007ffef1533a10   r15 = 0x00007f78d577b000
rip = 0x00007f7902146598
OS|Linux|0.0.0 Linux 4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018 x86_64
CPU|amd64|family 6 model 78 stepping 3|1
GPU|||
Crash|SIGSEGV|0x0|0
0|0|libxul.so|mozilla::dom::Performance::InsertResourceEntry|hg:hg.mozilla.org/mozilla-central:dom/performance/Performance.cpp:38b3c1d03a594664c6b32c35533734283c258f43|399|0x18
0|1|libxul.so|mozilla::dom::PerformanceMainThread::AddEntry|hg:hg.mozilla.org/mozilla-central:dom/performance/PerformanceMainThread.cpp:38b3c1d03a594664c6b32c35533734283c258f43|138|0xf
0|2|libxul.so|mozilla::net::nsHttpChannel::OnStopRequest|hg:hg.mozilla.org/mozilla-central:netwerk/protocol/http/nsHttpChannel.cpp:38b3c1d03a594664c6b32c35533734283c258f43|7316|0x13
0|3|libxul.so|nsInputStreamPump::OnStateStop|hg:hg.mozilla.org/mozilla-central:netwerk/base/nsInputStreamPump.cpp:38b3c1d03a594664c6b32c35533734283c258f43|708|0x1f
0|4|libxul.so|nsInputStreamPump::OnInputStreamReady|hg:hg.mozilla.org/mozilla-central:netwerk/base/nsInputStreamPump.cpp:38b3c1d03a594664c6b32c35533734283c258f43|436|0x8
0|5|libxul.so|nsInputStreamReadyEvent::Run|hg:hg.mozilla.org/mozilla-central:xpcom/io/nsStreamUtils.cpp:38b3c1d03a594664c6b32c35533734283c258f43|102|0x15
0|6|libxul.so|nsThread::ProcessNextEvent|hg:hg.mozilla.org/mozilla-central:xpcom/threads/nsThread.cpp:38b3c1d03a594664c6b32c35533734283c258f43|1040|0x15
0|7|libxul.so|NS_ProcessNextEvent|hg:hg.mozilla.org/mozilla-central:xpcom/threads/nsThreadUtils.cpp:38b3c1d03a594664c6b32c35533734283c258f43|517|0x11
0|8|libxul.so|mozilla::ipc::MessagePump::Run|hg:hg.mozilla.org/mozilla-central:ipc/glue/MessagePump.cpp:38b3c1d03a594664c6b32c35533734283c258f43|97|0xa
0|9|libxul.so|MessageLoop::RunInternal|hg:hg.mozilla.org/mozilla-central:ipc/chromium/src/base/message_loop.cc:38b3c1d03a594664c6b32c35533734283c258f43|326|0x17
0|10|libxul.so|MessageLoop::Run|hg:hg.mozilla.org/mozilla-central:ipc/chromium/src/base/message_loop.cc:38b3c1d03a594664c6b32c35533734283c258f43|319|0x8
0|11|libxul.so|nsBaseAppShell::Run|hg:hg.mozilla.org/mozilla-central:widget/nsBaseAppShell.cpp:38b3c1d03a594664c6b32c35533734283c258f43|157|0xd
0|12|libxul.so|nsAppStartup::Run|hg:hg.mozilla.org/mozilla-central:toolkit/components/startup/nsAppStartup.cpp:38b3c1d03a594664c6b32c35533734283c258f43|288|0xe
0|13|libxul.so|XREMain::XRE_mainRun|hg:hg.mozilla.org/mozilla-central:toolkit/xre/nsAppRunner.cpp:38b3c1d03a594664c6b32c35533734283c258f43|4673|0x15
0|14|libxul.so|XREMain::XRE_main|hg:hg.mozilla.org/mozilla-central:toolkit/xre/nsAppRunner.cpp:38b3c1d03a594664c6b32c35533734283c258f43|4808|0x8
0|15|libxul.so|XRE_main|hg:hg.mozilla.org/mozilla-central:toolkit/xre/nsAppRunner.cpp:38b3c1d03a594664c6b32c35533734283c258f43|4900|0x5
0|16|firefox|do_main|hg:hg.mozilla.org/mozilla-central:browser/app/nsBrowserApp.cpp:38b3c1d03a594664c6b32c35533734283c258f43|231|0x22
0|17|firefox|main|hg:hg.mozilla.org/mozilla-central:browser/app/nsBrowserApp.cpp:38b3c1d03a594664c6b32c35533734283c258f43|304|0xd
0|18|libc-2.23.so||||0x20830
0|19|firefox|MOZ_ReportAssertionFailure|hg:hg.mozilla.org/mozilla-central:mfbt/Assertions.h:38b3c1d03a594664c6b32c35533734283c258f43|164|0x5
Flags: in-testsuite?
Priority: -- → P3
As far as I can tell, this is a regression from bug 1425458.

In particular, https://hg.mozilla.org/mozilla-central/rev/619d2fe88e78799e1e5606159e228597c07f8021 removed the IsResourceEntryLimitReached() check in AddEntry().  And since setResourceTimingBufferSize() sets the buffer size but does _not_ shrink any existing buffer, it's trivial to land in AddEntry() with an overfull buffer if the page is using setResourceTimingBufferSize().

We should be able to write a simpler testcase for this....
Blocks: 1425458
Flags: needinfo?(amarchesini)
I do wonder why we don't have reasonable test coverage for setResourceTimingBufferSize().  :(  Neither testing/web-platform/tests/resource-timing/resource_timing_buffer_full_when_populate_entries.html nor testing/web-platform/tests/resource-timing/resource_timing_buffer_full_when_shrink_buffer_size.html seem to cover this basic case.
> In particular,
> https://hg.mozilla.org/mozilla-central/rev/
> 619d2fe88e78799e1e5606159e228597c07f8021 removed the
> IsResourceEntryLimitReached() check in AddEntry().  And since
> setResourceTimingBufferSize() sets the buffer size but does _not_ shrink any
> existing buffer, it's trivial to land in AddEntry() with an overfull buffer
> if the page is using setResourceTimingBufferSize().

This is wrong. That check is now here: https://searchfox.org/mozilla-central/source/dom/performance/Performance.cpp#422-425

The crash seems to happen on debug builds only because of this assertion: https://searchfox.org/mozilla-central/source/dom/performance/Performance.cpp#415
Flags: needinfo?(amarchesini)
Assignee: nobody → amarchesini
Attachment #8966837 - Flags: review?(bzbarsky)
Comment on attachment 8966837 [details] [diff] [review]
performance.patch

Ah, ok.  I forgot about that check-after-assert bit after digging through the history for a while...

r=me
Attachment #8966837 - Flags: review?(bzbarsky) → review+
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/fb6547e96546
Remove a wrong assertion related to the size of the Performance resource entries array in Performance::InsertResourceEntry, r=bz
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4220b682f56e
Fixed a WPT crash related to a remove a wrong assertion in Performance::InsertResourceEntry, r=me CLOSED TREE
https://hg.mozilla.org/mozilla-central/rev/fb6547e96546
https://hg.mozilla.org/mozilla-central/rev/4220b682f56e
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.