AssertedCast error: Cannot cast 72057598332895103 from int64_t to int32_t: out of range [@ mozilla::FrameParser::VBRHeader::ParseVBRI]
Categories
(Core :: Audio/Video: Playback, defect, P2)
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]
==45667==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fb6e669e9e4 bp 0x7fb69ec90ec0 sp 0x7fb69ec90aa0 T45711)
==45667==The signal is caused by a WRITE memory access.
==45667==Hint: address points to the zero page.
#0 0x7fb6e669e9e4 in MOZ_CrashSequence /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:237:3
#1 0x7fb6e669e9e4 in AssertedCast<int, long> /builds/worker/workspace/obj-build/dist/include/mozilla/Casting.h:238:5
#2 0x7fb6e669e9e4 in int mozilla::readAndConvertToInt<long>(mozilla::BufferReader*) /dom/media/mp3/MP3FrameParser.cpp:473:15
#3 0x7fb6e669e215 in mozilla::FrameParser::VBRHeader::ParseVBRI(mozilla::BufferReader*) /dom/media/mp3/MP3FrameParser.cpp:537:21
#4 0x7fb6e669ea3c in mozilla::FrameParser::VBRHeader::Parse(mozilla::BufferReader*, unsigned long) /dom/media/mp3/MP3FrameParser.cpp:575:29
#5 0x7fb6e6693587 in ParseVBRHeader /dom/media/mp3/MP3FrameParser.cpp:611:21
#6 0x7fb6e6693587 in mozilla::MP3TrackDemuxer::GetNextFrame(mozilla::media::Interval<long> const&) /dom/media/mp3/MP3Demuxer.cpp:655:17
#7 0x7fb6e6691b10 in mozilla::MP3TrackDemuxer::Init() /dom/media/mp3/MP3Demuxer.cpp:103:30
#8 0x7fb6e66919c5 in mozilla::MP3Demuxer::InitInternal() /dom/media/mp3/MP3Demuxer.cpp:41:25
#9 0x7fb6e6691fae in mozilla::MP3Demuxer::Init() /dom/media/mp3/MP3Demuxer.cpp:45:8
#10 0x7fb6e6290611 in operator() /dom/media/MediaFormatReader.cpp:824:47
#11 0x7fb6e6290611 in mozilla::detail::ProxyFunctionRunnable<mozilla::MediaFormatReader::DemuxerProxy::Init()::$_2, mozilla::MozPromise<mozilla::MediaResult, mozilla::MediaResult, false>>::Run() /builds/worker/workspace/obj-build/dist/include/mozilla/MozPromise.h:1838:29
#12 0x7fb6e1f41af0 in mozilla::TaskQueue::Runner::Run() /xpcom/threads/TaskQueue.cpp:311:20
#13 0x7fb6e1f6869e in nsThreadPool::Run() /xpcom/threads/nsThreadPool.cpp:446:14
#14 0x7fb6e1f5fec2 in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1162:16
#15 0x7fb6e1f6594f in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:461:10
#16 0x7fb6e2b56418 in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:299:20
#17 0x7fb6e2aae691 in RunHandler /ipc/chromium/src/base/message_loop.cc:366:3
#18 0x7fb6e2aae691 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:348:3
#19 0x7fb6e1f5baee in nsThread::ThreadFunc(void*) /xpcom/threads/nsThread.cpp:373:10
#20 0x7fb6f39f83ac in _pt_root /nsprpub/pr/src/pthreads/ptthread.c:191:3
#21 0x7fb6f369caa3 in start_thread ./nptl/pthread_create.c:447:8
#22 0x7fb6f3729c6b in clone3 ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
==45667==Register values:
rax = 0x00000000000000ee rbx = 0x0000000000000000 rcx = 0x000055b810fee118 rdx = 0x00007fb6f3804563
rdi = 0x00007fb6f3805700 rsi = 0x0000000000000000 rbp = 0x00007fb69ec90ec0 rsp = 0x00007fb69ec90aa0
r8 = 0x0000000000000000 r9 = 0x0000000000000003 r10 = 0x0000000000000002 r11 = 0x0000000000000293
r12 = 0x000055b823c55a78 r13 = 0x00007fb6e669e820 r14 = 0x00007fb69ec90aa0 r15 = 0x0000000000000004
UndefinedBehaviorSanitizer can not provide additional info.
SUMMARY: UndefinedBehaviorSanitizer: SEGV (/home/user/workspace/browsers/m-c-20260205163736-fuzzing-debug/libxul.so+0x909e9e4) (BuildId: 0b411186bb9521ab7e302998bc6191dc011c2d12)
==45667==ABORTING
| Reporter | ||
Comment 1•9 months ago
|
||
| Reporter | ||
Comment 2•9 months ago
|
||
| Reporter | ||
Updated•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
|
||
The VBRI parser was using AssertedCast<int> on values that could be
int64_t when vbriSeekOffsetsBytesPerEntry is 8. Since mTOC stores
int64_t values anyway, we can simply avoid the cast and use int64_t
throughout the reading path.
VBRI is completely obsolete, but still can be found and generated using old
software, and this is a clear error.
Updated•9 months ago
|
Updated•9 months ago
|
| Assignee | ||
Comment 6•9 months ago
|
||
This is UB, but we see that a very large value is output in practice. This is then safely handled line 190-191 when we attempt to seek. Not a security issue but a real bug, sec-other.
Comment 8•9 months ago
|
||
Comment 9•9 months ago
|
||
Verified bug as fixed on rev mozilla-central 20260213044212-cabf73b570b5.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.
Updated•8 months ago
|
| Reporter | ||
Updated•8 months ago
|
Updated•2 months ago
|
Description
•