<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - memory leak on some input PDFs in JPX code"
href="https://bugs.freedesktop.org/show_bug.cgi?id=102536">102536</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>memory leak on some input PDFs in JPX code
</td>
</tr>
<tr>
<th>Product</th>
<td>poppler
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>general
</td>
</tr>
<tr>
<th>Assignee</th>
<td>poppler-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>hanno@hboeck.de
</td>
</tr></table>
<p>
<div>
<pre>Check this PDF:
<a href="https://github.com/mozilla/pdf.js/blob/master/test/pdfs/issue5567.pdf">https://github.com/mozilla/pdf.js/blob/master/test/pdfs/issue5567.pdf</a>
Alternative PDF, triggering same bug:
<a href="http://web.archive.org/web/20160509072707/http://www.oranjewoudnv.nl/sites/default/files/Oranjewoud%20NV%20-%20%20besluiten%20aandeelhoudersvergadering%2011%20juni%202014.pdf">http://web.archive.org/web/20160509072707/http://www.oranjewoudnv.nl/sites/default/files/Oranjewoud%20NV%20-%20%20besluiten%20aandeelhoudersvergadering%2011%20juni%202014.pdf</a>
It will cause memory leaks in poppler, looks like it's calling openjpeg and not
properly cleaning up allocations.
To detect this I compiled poppler with address sanitizer:
./configure CC=clang CFLAGS="-fsanitize=address -g"
CXXFLAGS="-fsanitize=address -g" LDFLAGS="-fsanitize=address -g"
--enable-build-type=debugfull
And then used pdftoppm on the file.
To get a more detailed error message from asan I set
ASAN_OPTIONS="fast_unwind_on_malloc=0"
ASAN output:
==14313==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 120 byte(s) in 1 object(s) allocated from:
#0 0x7fe2928008e0 in calloc
(/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/libasan.so.3+0xc78e0)
#1 0x7fe28ed368c8 in opj_stream_create (/usr/lib64/libopenjp2.so.7+0x88c8)
#2 0x7fe292015a62 in JPXStreamPrivate::init2(CODEC_FORMAT, unsigned char*,
int, bool) /mnt/ram/poppler-0.57.0/poppler/JPEG2000Stream.cc:441
#3 0x7fe2920149a7 in JPXStream::init()
/mnt/ram/poppler-0.57.0/poppler/JPEG2000Stream.cc:388
#4 0x7fe292013bc0 in JPXStream::getImageParams(int*, StreamColorSpaceMode*)
/mnt/ram/poppler-0.57.0/poppler/JPEG2000Stream.cc:160
#5 0x7fe2920d80b9 in Gfx::doImage(Object*, Stream*, bool)
/mnt/ram/poppler-0.57.0/poppler/Gfx.cc:4281
#6 0x7fe2920d7752 in Gfx::opXObject(Object*, int)
/mnt/ram/poppler-0.57.0/poppler/Gfx.cc:4213
#7 0x7fe2920b1ed6 in Gfx::execOp(Object*, Object*, int)
/mnt/ram/poppler-0.57.0/poppler/Gfx.cc:909
#8 0x7fe2920b0fa0 in Gfx::go(bool)
/mnt/ram/poppler-0.57.0/poppler/Gfx.cc:767
#9 0x7fe2920b0ab0 in Gfx::display(Object*, bool)
/mnt/ram/poppler-0.57.0/poppler/Gfx.cc:729
#10 0x7fe292193ebb in Page::displaySlice(OutputDev*, double, double, int,
bool, bool, int, int, int, int, bool, bool (*)(void*), void*, bool (*)(Annot*,
void*), void*, bool) /mnt/ram/poppler-0.57.0/poppler/Page.cc:601
#11 0x7fe29219bb90 in PDFDoc::displayPageSlice(OutputDev*, int, double,
double, int, bool, bool, bool, int, int, int, int, bool (*)(void*), void*, bool
(*)(Annot*, void*), void*, bool) /mnt/ram/poppler-0.57.0/poppler/PDFDoc.cc:528
#12 0x556730076845 in savePageSlice
/mnt/ram/poppler-0.57.0/utils/pdftoppm.cc:225
#13 0x556730077b18 in main /mnt/ram/poppler-0.57.0/utils/pdftoppm.cc:532
#14 0x7fe291166520 in __libc_start_main (/lib64/libc.so.6+0x20520)
#15 0x5567300765f9 in _start
(/mnt/ram/poppler-0.57.0/utils/.libs/pdftoppm+0x55f9)
Indirect leak of 1048576 byte(s) in 1 object(s) allocated from:
#0 0x7fe292800720 in malloc
(/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/libasan.so.3+0xc7720)
#1 0x7fe28ed368e0 in opj_stream_create (/usr/lib64/libopenjp2.so.7+0x88e0)
#2 0x7fe292015a62 in JPXStreamPrivate::init2(CODEC_FORMAT, unsigned char*,
int, bool) /mnt/ram/poppler-0.57.0/poppler/JPEG2000Stream.cc:441
#3 0x7fe2920149a7 in JPXStream::init()
/mnt/ram/poppler-0.57.0/poppler/JPEG2000Stream.cc:388
#4 0x7fe292013bc0 in JPXStream::getImageParams(int*, StreamColorSpaceMode*)
/mnt/ram/poppler-0.57.0/poppler/JPEG2000Stream.cc:160
#5 0x7fe2920d80b9 in Gfx::doImage(Object*, Stream*, bool)
/mnt/ram/poppler-0.57.0/poppler/Gfx.cc:4281
#6 0x7fe2920d7752 in Gfx::opXObject(Object*, int)
/mnt/ram/poppler-0.57.0/poppler/Gfx.cc:4213
#7 0x7fe2920b1ed6 in Gfx::execOp(Object*, Object*, int)
/mnt/ram/poppler-0.57.0/poppler/Gfx.cc:909
#8 0x7fe2920b0fa0 in Gfx::go(bool)
/mnt/ram/poppler-0.57.0/poppler/Gfx.cc:767
#9 0x7fe2920b0ab0 in Gfx::display(Object*, bool)
/mnt/ram/poppler-0.57.0/poppler/Gfx.cc:729
#10 0x7fe292193ebb in Page::displaySlice(OutputDev*, double, double, int,
bool, bool, int, int, int, int, bool, bool (*)(void*), void*, bool (*)(Annot*,
void*), void*, bool) /mnt/ram/poppler-0.57.0/poppler/Page.cc:601
#11 0x7fe29219bb90 in PDFDoc::displayPageSlice(OutputDev*, int, double,
double, int, bool, bool, bool, int, int, int, int, bool (*)(void*), void*, bool
(*)(Annot*, void*), void*, bool) /mnt/ram/poppler-0.57.0/poppler/PDFDoc.cc:528
#12 0x556730076845 in savePageSlice
/mnt/ram/poppler-0.57.0/utils/pdftoppm.cc:225
#13 0x556730077b18 in main /mnt/ram/poppler-0.57.0/utils/pdftoppm.cc:532
#14 0x7fe291166520 in __libc_start_main (/lib64/libc.so.6+0x20520)
#15 0x5567300765f9 in _start
(/mnt/ram/poppler-0.57.0/utils/.libs/pdftoppm+0x55f9)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>