Open
Bug 798566
Opened 14 years ago
Updated 2 years ago
Mismatched free in ots::ots_name_parse
Categories
(Core :: Graphics: Text, defect, P5)
Tracking
()
REOPENED
People
(Reporter: snorp, Unassigned)
Details
Attachments
(1 file)
|
628 bytes,
patch
|
jfkthame
:
review-
snorp
:
feedback+
|
Details | Diff | Splinter Review |
The following is from a Valgrind run:
I/sh ( 2918): ==2919== Mismatched free() / delete / delete []
I/sh ( 2918): ==2919== at 0x482A644: operator delete[](void*) (vg_replace_malloc.c:515)
I/sh ( 2918): ==2919== by 0x325E50C5: ots::ots_name_parse(ots::OpenTypeFile*, unsigned char const*, unsigned int) (_new.h:135)
I/sh ( 2918): ==2919== by 0x325E7865: (anonymous namespace)::ProcessGeneric(ots::OpenTypeFile*, unsigned int, ots::OTSStream*, unsigned char const*, unsigned int, std::vector<(anonymous namespace)::OpenTypeTable, std::allocator<(anonymous namespace)::OpenTypeTable> > const&, ots::Buffer&) (ots.cc:567)
I/sh ( 2918): ==2919== by 0x325E8897: ots::Process(ots::OTSStream*, unsigned char const*, unsigned int, bool (*)(void*, char const*, ...), void*, bool) (ots.cc:430)
I/sh ( 2918): ==2919== by 0x32582F07: gfxUserFontSet::SanitizeOpenTypeData(gfxProxyFontEntry*, unsigned char const*, unsigned int, unsigned int&, bool) (gfxUserFontSet.cpp:376)
I/sh ( 2918): ==2919== by 0x32583A7F: gfxUserFontSet::LoadFont(gfxProxyFontEntry*, unsigned char const*, unsigned int&) (gfxUserFontSet.cpp:675)
I/sh ( 2918): ==2919== by 0x325842FF: gfxUserFontSet::OnLoadComplete(gfxProxyFontEntry*, unsigned char const*, unsigned int, tag_nsresult) (gfxUserFontSet.cpp:472)
I/sh ( 2918): ==2919== by 0x31C46B91: nsFontFaceLoader::OnStreamComplete(nsIStreamLoader*, nsISupports*, tag_nsresult, unsigned int, unsigned char const*) (nsFontFaceLoader.cpp:211)
I/sh ( 2918): ==2919== by 0x31A4DA1D: nsStreamLoader::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) (nsStreamLoader.cpp:95)
I/sh ( 2918): ==2919== by 0x31CD8C13: nsCORSListenerProxy::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) (nsCrossSiteListenerProxy.cpp:572)
I/sh ( 2918): ==2919== by 0x31A4D7FD: nsStreamListenerTee::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) (nsStreamListenerTee.cpp:49)
I/sh ( 2918): ==2919== by 0x31AA9DD9: mozilla::net::nsHttpChannel::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) (nsHttpChannel.cpp:4992)
I/sh ( 2918): ==2919== by 0x31A390AD: nsInputStreamPump::OnStateStop() (nsInputStreamPump.cpp:552)
I/sh ( 2918): ==2919== by 0x31A3920D: nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) (nsInputStreamPump.cpp:374)
I/sh ( 2918): ==2919== by 0x324F6A49: nsInputStreamReadyEvent::Run() (nsStreamUtils.cpp:82)
I/sh ( 2918): ==2919== by 0x32504123: nsThread::ProcessNextEvent(bool, bool*) (nsThread.cpp:612)
I/sh ( 2918): ==2919== by 0x324DAF2F: NS_ProcessNextEvent_P(nsIThread*, bool) (nsThreadUtils.cpp:220)
I/sh ( 2918): ==2919== by 0x3250437B: nsThread::Shutdown() (nsThread.cpp:465)
I/sh ( 2918): ==2919== by 0x325051A3: nsRunnableMethodImpl<tag_nsresult (nsIThread::*)(), true>::Run() (nsThreadUtils.h:349)
I/sh ( 2918): ==2919== by 0x32504123: nsThread::ProcessNextEvent(bool, bool*) (nsThread.cpp:612)
I/sh ( 2918): ==2919== Address 0x1f7c0330 is 0 bytes inside a block of size 157 alloc'd
I/sh ( 2918): ==2919== at 0x482B920: malloc (vg_replace_malloc.c:270)
I/sh ( 2918): ==2919== by 0x308C061F: moz_xmalloc (mozalloc.cpp:57)
I/sh ( 2918): ==2919== by 0x32314A1D: std::string::_M_reserve(unsigned int) (_new.h:134)
I/sh ( 2918): ==2919== by 0x32314ADD: std::string::append(unsigned int, char) (_string.c:185)
I/sh ( 2918): ==2919== by 0x325E50AB: ots::ots_name_parse(ots::OpenTypeFile*, unsigned char const*, unsigned int) (_string.h:408)
I/sh ( 2918): ==2919== by 0x325E7865: (anonymous namespace)::ProcessGeneric(ots::OpenTypeFile*, unsigned int, ots::OTSStream*, unsigned char const*, unsigned int, std::vector<(anonymous namespace)::OpenTypeTable, std::allocator<(anonymous namespace)::OpenTypeTable> > const&, ots::Buffer&) (ots.cc:567)
I/sh ( 2918): ==2919== by 0x325E8897: ots::Process(ots::OTSStream*, unsigned char const*, unsigned int, bool (*)(void*, char const*, ...), void*, bool) (ots.cc:430)
I/sh ( 2918): ==2919== by 0x32582F07: gfxUserFontSet::SanitizeOpenTypeData(gfxProxyFontEntry*, unsigned char const*, unsigned int, unsigned int&, bool) (gfxUserFontSet.cpp:376)
I/sh ( 2918): ==2919== by 0x32583A7F: gfxUserFontSet::LoadFont(gfxProxyFontEntry*, unsigned char const*, unsigned int&) (gfxUserFontSet.cpp:675)
I/sh ( 2918): ==2919== by 0x325842FF: gfxUserFontSet::OnLoadComplete(gfxProxyFontEntry*, unsigned char const*, unsigned int, tag_nsresult) (gfxUserFontSet.cpp:472)
I/sh ( 2918): ==2919== by 0x31C46B91: nsFontFaceLoader::OnStreamComplete(nsIStreamLoader*, nsISupports*, tag_nsresult, unsigned int, unsigned char const*) (nsFontFaceLoader.cpp:211)
I/sh ( 2918): ==2919== by 0x31A4DA1D: nsStreamLoader::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) (nsStreamLoader.cpp:95)
I/sh ( 2918): ==2919== by 0x31CD8C13: nsCORSListenerProxy::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) (nsCrossSiteListenerProxy.cpp:572)
I/sh ( 2918): ==2919== by 0x31A4D7FD: nsStreamListenerTee::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) (nsStreamListenerTee.cpp:49)
I/sh ( 2918): ==2919== by 0x31AA9DD9: mozilla::net::nsHttpChannel::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) (nsHttpChannel.cpp:4992)
I/sh ( 2918): ==2919== by 0x31A390AD: nsInputStreamPump::OnStateStop() (nsInputStreamPump.cpp:552)
I/sh ( 2918): ==2919== by 0x31A3920D: nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) (nsInputStreamPump.cpp:374)
I/sh ( 2918): ==2919== by 0x324F6A49: nsInputStreamReadyEvent::Run() (nsStreamUtils.cpp:82)
I/sh ( 2918): ==2919== by 0x32504123: nsThread::ProcessNextEvent(bool, bool*) (nsThread.cpp:612)
I/sh ( 2918): ==2919== by 0x324DAF2F: NS_ProcessNextEvent_P(nsIThread*, bool) (nsThreadUtils.cpp:220)
| Reporter | ||
Updated•14 years ago
|
Updated•14 years ago
|
tracking-fennec: --- → ?
Comment 1•14 years ago
|
||
snorp, this isn't obvious to me. Could you run this patch through valgrind to see if it clears the warning?
Assignee: nobody → blassey.bugs
Attachment #669108 -
Flags: feedback?(snorp)
Updated•14 years ago
|
tracking-fennec: ? → +
Comment 2•14 years ago
|
||
snorp, ping?
| Reporter | ||
Comment 3•14 years ago
|
||
Looks like the fix worked, I don't see it in my trace.
| Reporter | ||
Updated•14 years ago
|
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment 4•14 years ago
|
||
(In reply to James Willcox (:snorp) (jwillcox@mozilla.com) from comment #3)
> Looks like the fix worked, I don't see it in my trace.
did you land the patch?
| Reporter | ||
Comment 5•14 years ago
|
||
(In reply to Brad Lassey [:blassey] from comment #4)
> (In reply to James Willcox (:snorp) (jwillcox@mozilla.com) from comment #3)
> > Looks like the fix worked, I don't see it in my trace.
>
> did you land the patch?
Oh, I thought it was already landed. Hmm. I guess I didn't manage to hit the right code path. I wonder if you have to hit a page with @font-face, since that's what I was doing when I originally found this. Will try again.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Reporter | ||
Comment 6•13 years ago
|
||
Comment on attachment 669108 [details] [diff] [review]
patch
Review of attachment 669108 [details] [diff] [review]:
-----------------------------------------------------------------
IIRC this actually did fix the valgrind problem
Attachment #669108 -
Flags: feedback?(snorp) → feedback+
Updated•13 years ago
|
Attachment #669108 -
Flags: review?(jmuizelaar)
Updated•13 years ago
|
Attachment #669108 -
Flags: review?(jmuizelaar) → review?(jfkthame)
Comment 7•13 years ago
|
||
Comment on attachment 669108 [details] [diff] [review]
patch
Review of attachment 669108 [details] [diff] [review]:
-----------------------------------------------------------------
This can't be right, AFAICT. Observe that the normal fate of the OpenTypeNAME object being allocated by 'new' here is to be stored in the file->name field, and eventually freed in ots_name_free(), which (correctly) calls 'delete' on it.
In addition, the handling of all the other font tables in OTS is directly parallel to this: they allocate an object using 'new' in the ots_XXXX_parse() function, save it in a field of the 'file' object, and eventually 'delete' it in their ots_XXXX_free() function. Why would the 'name' table be somehow special?
If we're getting an allocator mismatch related to one of these tables, this seems to imply a deeper problem with the build configuration - maybe some issue whereby the replacement of operators new/delete (is jemalloc involved here, or what?) isn't being done consistently for all the OTS code. We need to figure out the real problem there, not hack an individual one of the allocation sites (in such a way that if the build is all correct, we'll then have a mismatch because it's still freed using delete!)
Attachment #669108 -
Flags: review?(jfkthame) → review-
Updated•13 years ago
|
Assignee: blassey.bugs → snorp
Updated•10 years ago
|
Component: Graphics, Panning and Zooming → Graphics: Text
Product: Firefox for Android → Core
Updated•4 years ago
|
Assignee: snorp → nobody
Updated•4 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•