AssertedCast error: Cannot cast 9223372036855000000 from uint64_t to int64_t: out of range [@ mozilla::WebMContainerParser::ParseStartAndEndTimestamps]
Categories
(Core :: Audio/Video: Playback, defect)
Tracking
()
People
(Reporter: tsmith, Assigned: padenot)
Details
(4 keywords, Whiteboard: [bugmon:bisected,confirmed][adv-main149-])
Crash Data
Attachments
(2 files, 1 external file)
Reproduced on mozilla-central rev ed1c0b4f0bbe (built with: --enable-debug --enable-fuzzing).
Testcase can be reproduced using the following commands:
$ pip install fuzzfetch grizzly-framework pipx --upgrade
$ python -m pipx ensurepath
$ fuzzfetch --build ed1c0b4f0bbe --debug --fuzzing -n firefox
$ grizzly-replay-bugzilla ./firefox/firefox <bugid>
[@ MOZ_CrashSequence]
==45991==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7b68b4073f13 bp 0x7b689c81f5d0 sp 0x7b689c81f0f0 T46031)
==45991==The signal is caused by a WRITE memory access.
==45991==Hint: address points to the zero page.
#0 0x7b68b4073f13 in MOZ_CrashSequence /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:237:3
#1 0x7b68b4073f13 in AssertedCast<long, unsigned long> /builds/worker/workspace/obj-build/dist/include/mozilla/Casting.h:238:5
#2 0x7b68b4073f13 in mozilla::WebMContainerParser::ParseStartAndEndTimestamps(mozilla::MediaSpan const&, mozilla::media::TimeUnit&, mozilla::media::TimeUnit&) /dom/media/mediasource/ContainerParser.cpp:287:9
#3 0x7b68b40636d4 in mozilla::TrackBuffersManager::SegmentParserLoop() /dom/media/mediasource/TrackBuffersManager.cpp:1008:26
#4 0x7b68af6d1286 in operator()<> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1083:18
#5 0x7b68af6d1286 in __invoke_impl<nsresult, (lambda at /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1082:9)> /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
#6 0x7b68af6d1286 in __invoke<(lambda at /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1082:9)> /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
#7 0x7b68af6d1286 in __apply_impl<(lambda at /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1082:9), std::tuple<> &> /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tuple:1740:14
#8 0x7b68af6d1286 in apply<(lambda at /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1082:9), std::tuple<> &> /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tuple:1751:14
#9 0x7b68af6d1286 in apply<nsIThread, nsresult (nsIThread::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1081:12
#10 0x7b68af6d1286 in mozilla::detail::RunnableMethodImpl<nsUpdateProcessor*, void (nsUpdateProcessor::*)(), true, (mozilla::RunnableKind)0>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1132:13
#11 0x7b68af941af0 in mozilla::TaskQueue::Runner::Run() /xpcom/threads/TaskQueue.cpp:311:20
#12 0x7b68af96869e in nsThreadPool::Run() /xpcom/threads/nsThreadPool.cpp:446:14
#13 0x7b68af95fec2 in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1162:16
#14 0x7b68af96594f in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:461:10
#15 0x7b68b0556418 in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:299:20
#16 0x7b68b04ae691 in RunHandler /ipc/chromium/src/base/message_loop.cc:366:3
#17 0x7b68b04ae691 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:348:3
#18 0x7b68af95baee in nsThread::ThreadFunc(void*) /xpcom/threads/nsThread.cpp:373:10
#19 0x7b68c173e3ac in _pt_root /nsprpub/pr/src/pthreads/ptthread.c:191:3
#20 0x7b68c109caa3 in start_thread ./nptl/pthread_create.c:447:8
#21 0x7b68c1129c6b in clone3 ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
==45991==Register values:
rax = 0x00000000000000ee rbx = 0x00007b689c81f1a0 rcx = 0x000055c8a317c118 rdx = 0x00007b68c1204563
rdi = 0x00007b68c1205700 rsi = 0x0000000000000000 rbp = 0x00007b689c81f5d0 rsp = 0x00007b689c81f0f0
r8 = 0x0000000000000000 r9 = 0x0000000000000003 r10 = 0x0000000000000002 r11 = 0x0000000000000293
r12 = 0x0000000000000001 r13 = 0x8000000000036bc0 r14 = 0x0000000000000000 r15 = 0x0000000001f78a40
UndefinedBehaviorSanitizer can not provide additional info.
SUMMARY: UndefinedBehaviorSanitizer: SEGV (/home/user/workspace/browsers/m-c-20260205163736-fuzzing-debug/libxul.so+0x9073f13) (BuildId: 0b411186bb9521ab7e302998bc6191dc011c2d12)
==45991==ABORTING
| Reporter | ||
Comment 1•9 months ago
|
||
| Reporter | ||
Comment 2•9 months ago
|
||
| Reporter | ||
Updated•9 months ago
|
Comment 3•9 months ago
|
||
Verified bug as reproducible on mozilla-central 20260205213633-279b57ef4bf0.
Unable to bisect testcase (Testcase reproduces on start build!):
Start: ce0f77cae5a91e2cb4b1ec859117e08aa1182c52 (20250207164009)
End: ed1c0b4f0bbef7e458685d5f4743c73ae66cc3fd (20260205163736)
BuildFlags: BuildFlags(asan=False, tsan=False, debug=True, fuzzing=True, coverage=False, valgrind=False, no_opt=False, fuzzilli=False, nyx=False, searchfox=False, afl=False)
Updated•9 months ago
|
| Reporter | ||
Comment 4•9 months ago
|
||
Running this in an ASan build does not trigger a failure.
| Assignee | ||
Comment 5•9 months ago
|
||
When processing WebM clusters, the parser multiplies the cluster timecode
by the timecode scale to compute absolute timestamps. Malformed media files
can contain crafted values that cause this multiplication to overflow,
exceeding INT64_MAX. This triggers an AssertedCast crash when the result
is later cast to int64_t.
This patch adds overflow validation using CheckedInt before the cast. If
the multiplication overflows or exceeds INT64_MAX, the timecode is rejected
and logged, similar to how out-of-order timecodes are already handled. This
prevents the crash while allowing the parser to continue processing valid
portions of the media.
Updated•9 months ago
|
Updated•9 months ago
|
| Assignee | ||
Comment 6•9 months ago
|
||
UB, in practice this outputs a wrong timestamp, and playback will fail, not a sec issue. sec-other.
| Assignee | ||
Updated•9 months ago
|
Comment 8•9 months ago
|
||
Updated•9 months ago
|
Comment 9•9 months ago
|
||
Verified bug as fixed on rev mozilla-central 20260213093634-c898f98e4898.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.
Updated•9 months ago
|
Updated•8 months ago
|
| Reporter | ||
Updated•8 months ago
|
Updated•2 months ago
|
Description
•