Closed Bug 1418028 Opened 6 years ago Closed 6 years ago

UBSan: null pointer passed as argument declared to never be null [@ mozilla::net::CacheFileMetadata::WriteMetadata]

Categories

(Core :: Networking: Cache, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: tsmith, Assigned: michal)

Details

(Keywords: csectype-undefined, Whiteboard: [necko-triaged])

Attachments

(1 file)

This error is triggered after a few page loads when Firefox is built with: -fsanitize=nonnull-attribute

/mozilla-central/netwerk/cache2/CacheFileMetadata.cpp:276:13: runtime error: null pointer passed as argument 2, which is declared to never be null
/usr/include/string.h:43:28: note: nonnull attribute specified here
    #0 0x7f8a3e7e90ba in mozilla::net::CacheFileMetadata::WriteMetadata(unsigned int, mozilla::net::CacheFileMetadataListener*) /mozilla-central/netwerk/cache2/CacheFileMetadata.cpp:276:3
    #1 0x7f8a3e7dae24 in mozilla::net::CacheFile::WriteMetadataIfNeededLocked(bool) /mozilla-central/netwerk/cache2/CacheFile.cpp:2436:19
    #2 0x7f8a3e7e87df in mozilla::net::CacheFile::WriteMetadataIfNeeded() /mozilla-central/netwerk/cache2/CacheFile.cpp:2399:5
    #3 0x7f8a3e7ff472 in mozilla::net::CacheFileIOManager::Notify(nsITimer*) /mozilla-central/netwerk/cache2/CacheFileIOManager.cpp:1621:11
    #4 0x7f8a3de8f7aa in nsTimerImpl::Fire(int) /mozilla-central/xpcom/threads/nsTimerImpl.cpp:704:40
    #5 0x7f8a3de45d5f in nsTimerEvent::Run() /mozilla-central/xpcom/threads/TimerThread.cpp:286:11
    #6 0x7f8a3de51309 in nsThread::ProcessNextEvent(bool, bool*) /mozilla-central/xpcom/threads/nsThread.cpp:1037:14
    #7 0x7f8a3e82229c in mozilla::net::CacheIOThread::ThreadFunc() /mozilla-central/netwerk/cache2/CacheIOThread.cpp:493:24
    #8 0x7f8a3e821648 in mozilla::net::CacheIOThread::ThreadFunc(void*) /mozilla-central/netwerk/cache2/CacheIOThread.cpp:450:11
    #9 0x7f8a70570d2d in _pt_root /mozilla-central/nsprpub/pr/src/pthreads/ptthread.c:216:5
    #10 0x7f8a73e0b7fb in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x77fb)
    #11 0x7f8a72e39b0e in clone /build/glibc-CxtIbX/glibc-2.26/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Assignee: nobody → michal.novotny
Priority: -- → P3
Whiteboard: [necko-triaged]
Attached patch fixSplinter Review
Skip writing empty elements. Elements can be null, so this fix is correct, but it's interesting that it happens so often. I'll investigate it and eventually file a separate bug which will eliminate writes that are not necessary.
Attachment #8943651 - Flags: review?(honzab.moz)
Attachment #8943651 - Flags: review?(honzab.moz) → review+
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/feb3c3fd79ca
UBSan: null pointer passed to memcpy in CacheFileMetadata::WriteMetadata. r=honzab
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/feb3c3fd79ca
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.