Bug 96269 - poppler-0.44.0: memory leak (valgrind) in Gfx::doImage on broken file
Summary: poppler-0.44.0: memory leak (valgrind) in Gfx::doImage on broken file
Status: RESOLVED MOVED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-29 17:31 UTC by LE GARREC Vincent
Modified: 2018-08-21 10:54 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
memory-leak-colorMap.pdf (1.62 KB, application/pdf)
2016-05-29 17:34 UTC, LE GARREC Vincent
Details
memory-leak-colorMap.patch (2.99 KB, patch)
2016-05-29 17:36 UTC, LE GARREC Vincent
Details | Splinter Review
memory-leak-colorMap-2.patch (3.34 KB, patch)
2016-05-29 17:51 UTC, LE GARREC Vincent
Details | Splinter Review

Description LE GARREC Vincent 2016-05-29 17:31:52 UTC
colorMap is not freed on broken file.

==10237== 1,472,616 (217,200 direct, 1,255,416 indirect) bytes in 181 blocks are definitely lost in loss record 45 of 46
==10237==    at 0x4C2C25D: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10237==    by 0x4FC00D4: Gfx::doImage(Object*, Stream*, bool) (in /usr/lib64/libpoppler.so.60.0.0)
==10237==    by 0x4FBEEE9: Gfx::opXObject(Object*, int) (in /usr/lib64/libpoppler.so.60.0.0)
==10237==    by 0x4FABE4B: Gfx::execOp(Object*, Object*, int) (in /usr/lib64/libpoppler.so.60.0.0)
==10237==    by 0x4FAB6DF: Gfx::go(bool) (in /usr/lib64/libpoppler.so.60.0.0)
==10237==    by 0x4FAB4B0: Gfx::display(Object*, bool) (in /usr/lib64/libpoppler.so.60.0.0)
==10237==    by 0x50180C2: Page::displaySlice(OutputDev*, double, double, int, bool, bool, int, int, int, int, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) (in /usr/lib64/libpoppler.so.60.0.0)
==10237==    by 0x5017AFF: Page::display(OutputDev*, double, double, int, bool, bool, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) (in /usr/lib64/libpoppler.so.60.0.0)
==10237==    by 0x501BB8E: PDFDoc::displayPage(OutputDev*, int, double, double, int, bool, bool, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*, bool) (in /usr/lib64/libpoppler.so.60.0.0)
==10237==    by 0x501BC2F: PDFDoc::displayPages(OutputDev*, int, int, double, double, int, bool, bool, bool, bool (*)(void*), void*, bool (*)(Annot*, void*), void*) (in /usr/lib64/libpoppler.so.60.0.0)
==10237==    by 0x40EEF4: main (in /usr/bin/pdftohtml)
Comment 1 LE GARREC Vincent 2016-05-29 17:34:12 UTC
Created attachment 124160 [details]
memory-leak-colorMap.pdf
Comment 2 LE GARREC Vincent 2016-05-29 17:36:41 UTC
Created attachment 124161 [details] [review]
memory-leak-colorMap.patch

Proposal patch.
Comment 3 LE GARREC Vincent 2016-05-29 17:51:55 UTC
Created attachment 124163 [details] [review]
memory-leak-colorMap-2.patch

A better patch with maskObj and smaskObj.
Comment 4 Albert Astals Cid 2016-05-29 20:47:45 UTC
For this i wanted to ask the membership to allow the use of C++11 for things like std::unique_ptr that will delete colorMap when it goes of scope.

And i also wanted to introduce something like a ObjectDeleter that will free the object when it goes out of scope so we don't have to do all that managing by hand.

I'll send the email now and let's see what the community thinks.

Meanwhile let's put this on hold since the leak it only happens on wrong documents it's not *that* important.
Comment 5 LE GARREC Vincent 2016-05-29 21:24:01 UTC
No problem. I just wanted to see how deep I can go with afl.
There's few things I'd like to hack with afl but I don't know if I'll be able to find something more. I will keep you in touch.

About C++11 and std::unique_ptr, I'm agree with you. I didn't asked about it because the source is "C++11"less.
Comment 6 GitLab Migration User 2018-08-21 10:54:03 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/poppler/poppler/issues/419.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.