Discussion:
[gs-bugs] [Bug 698827] - MuPDF - Memory leak while rendering PDF
b***@artifex.com
2017-12-20 00:59:44 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698827

Bug ID: 698827
Summary: Memory leak while rendering PDF
Product: MuPDF
Version: master
Hardware: PC
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: P4
Component: mupdf
Assignee: mupdf-***@artifex.com
Reporter: ***@hotmail.com
QA Contact: gs-***@ghostscript.com
Word Size: ---

While rendering http://www.pdfill.com/download/PDFSPEC13.pdf using "mutool draw
-s t PDFSPEC13.pdf 291" I see the following ASAN complaint:

=================================================================
==29358==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 88 byte(s) in 1 object(s) allocated from:
#0 0x7ff58a576c20 in __interceptor_malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0xd9c20)
#1 0x555f4bc69e9d in fz_malloc_default source/fitz/memory.c:227
#2 0x555f4bc6905d in do_scavenging_malloc source/fitz/memory.c:22
#3 0x555f4bc6975b in fz_calloc source/fitz/memory.c:124
#4 0x555f4bc9db49 in fz_new_pixmap_from_pixmap source/fitz/pixmap.c:149
#5 0x555f4bbc46cf in fz_draw_end_tile source/fitz/draw-device.c:2761
#6 0x555f4bb9f5f2 in fz_end_tile source/fitz/device.c:514
#7 0x555f4beb711d in pdf_show_pattern source/pdf/pdf-op-run.c:435
#8 0x555f4bebb3b3 in pdf_flush_text source/pdf/pdf-op-run.c:798
#9 0x555f4bec3075 in pdf_run_ET source/pdf/pdf-op-run.c:1690
#10 0x555f4be972d0 in pdf_process_keyword source/pdf/pdf-interpret.c:665
#11 0x555f4be9afa2 in pdf_process_stream source/pdf/pdf-interpret.c:963
#12 0x555f4be9b952 in pdf_process_contents source/pdf/pdf-interpret.c:1057
#13 0x555f4bd868a8 in pdf_run_page_contents_with_usage
source/pdf/pdf-run.c:84
#14 0x555f4bd86d51 in pdf_run_page_contents source/pdf/pdf-run.c:110
#15 0x555f4bba15c7 in fz_run_page_contents source/fitz/document.c:368
#16 0x555f4bba1889 in fz_run_page source/fitz/document.c:400
#17 0x555f4bb2a393 in drawband source/tools/mudraw.c:489
#18 0x555f4bb2e168 in dodrawpage source/tools/mudraw.c:887
#19 0x555f4bb304f7 in drawpage source/tools/mudraw.c:1180
#20 0x555f4bb30a3e in drawrange source/tools/mudraw.c:1209
#21 0x555f4bb34b9b in mudraw_main source/tools/mudraw.c:1921
#22 0x555f4bb280d0 in main source/tools/mutool.c:127
#23 0x7ff589be9560 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20560)

Indirect leak of 14884 byte(s) in 1 object(s) allocated from:
#0 0x7ff58a576c20 in __interceptor_malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0xd9c20)
#1 0x555f4bc69e9d in fz_malloc_default source/fitz/memory.c:227
#2 0x555f4bc6905d in do_scavenging_malloc source/fitz/memory.c:22
#3 0x555f4bc69488 in fz_malloc_array source/fitz/memory.c:88
#4 0x555f4bc9ced5 in fz_new_pixmap_with_data source/fitz/pixmap.c:81
#5 0x555f4bc9d0b9 in fz_new_pixmap source/fitz/pixmap.c:102
#6 0x555f4bc9d207 in fz_new_pixmap_with_bbox source/fitz/pixmap.c:109
#7 0x555f4bbc2e00 in fz_draw_begin_tile source/fitz/draw-device.c:2641
#8 0x555f4bb9f317 in fz_begin_tile_id source/fitz/device.c:492
#9 0x555f4beb70c4 in pdf_show_pattern source/pdf/pdf-op-run.c:432
#10 0x555f4beb9d1f in pdf_show_path source/pdf/pdf-op-run.c:651
#11 0x555f4bec2bb6 in pdf_run_f source/pdf/pdf-op-run.c:1623
#12 0x555f4be96eba in pdf_process_keyword source/pdf/pdf-interpret.c:651
#13 0x555f4be9afa2 in pdf_process_stream source/pdf/pdf-interpret.c:963
#14 0x555f4be9b952 in pdf_process_contents source/pdf/pdf-interpret.c:1057
#15 0x555f4bd868a8 in pdf_run_page_contents_with_usage
source/pdf/pdf-run.c:84
#16 0x555f4bd86d51 in pdf_run_page_contents source/pdf/pdf-run.c:110
#17 0x555f4bba15c7 in fz_run_page_contents source/fitz/document.c:368
#18 0x555f4bba1889 in fz_run_page source/fitz/document.c:400
#19 0x555f4bb2a393 in drawband source/tools/mudraw.c:489
#20 0x555f4bb2e168 in dodrawpage source/tools/mudraw.c:887
#21 0x555f4bb304f7 in drawpage source/tools/mudraw.c:1180
#22 0x555f4bb30a3e in drawrange source/tools/mudraw.c:1209
#23 0x555f4bb34b9b in mudraw_main source/tools/mudraw.c:1921
#24 0x555f4bb280d0 in main source/tools/mutool.c:127
#25 0x7ff589be9560 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20560)

Indirect leak of 88 byte(s) in 1 object(s) allocated from:
#0 0x7ff58a576c20 in __interceptor_malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0xd9c20)
#1 0x555f4bc69e9d in fz_malloc_default source/fitz/memory.c:227
#2 0x555f4bc6905d in do_scavenging_malloc source/fitz/memory.c:22
#3 0x555f4bc6975b in fz_calloc source/fitz/memory.c:124
#4 0x555f4bc9c8b7 in fz_new_pixmap_with_data source/fitz/pixmap.c:49
#5 0x555f4bc9d0b9 in fz_new_pixmap source/fitz/pixmap.c:102
#6 0x555f4bc9d207 in fz_new_pixmap_with_bbox source/fitz/pixmap.c:109
#7 0x555f4bbc2e00 in fz_draw_begin_tile source/fitz/draw-device.c:2641
#8 0x555f4bb9f317 in fz_begin_tile_id source/fitz/device.c:492
#9 0x555f4beb70c4 in pdf_show_pattern source/pdf/pdf-op-run.c:432
#10 0x555f4beb9d1f in pdf_show_path source/pdf/pdf-op-run.c:651
#11 0x555f4bec2bb6 in pdf_run_f source/pdf/pdf-op-run.c:1623
#12 0x555f4be96eba in pdf_process_keyword source/pdf/pdf-interpret.c:651
#13 0x555f4be9afa2 in pdf_process_stream source/pdf/pdf-interpret.c:963
#14 0x555f4be9b952 in pdf_process_contents source/pdf/pdf-interpret.c:1057
#15 0x555f4bd868a8 in pdf_run_page_contents_with_usage
source/pdf/pdf-run.c:84
#16 0x555f4bd86d51 in pdf_run_page_contents source/pdf/pdf-run.c:110
#17 0x555f4bba15c7 in fz_run_page_contents source/fitz/document.c:368
#18 0x555f4bba1889 in fz_run_page source/fitz/document.c:400
#19 0x555f4bb2a393 in drawband source/tools/mudraw.c:489
#20 0x555f4bb2e168 in dodrawpage source/tools/mudraw.c:887
#21 0x555f4bb304f7 in drawpage source/tools/mudraw.c:1180
#22 0x555f4bb30a3e in drawrange source/tools/mudraw.c:1209
#23 0x555f4bb34b9b in mudraw_main source/tools/mudraw.c:1921
#24 0x555f4bb280d0 in main source/tools/mutool.c:127
#25 0x7ff589be9560 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20560)

SUMMARY: AddressSanitizer: 15060 byte(s) leaked in 3 allocation(s).
--
You are receiving this mail because:
You are the QA Contact for the bug.
b***@artifex.com
2017-12-20 01:34:44 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698827

Sebastian Rasmussen <***@hotmail.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
URL| |http://www.pdfill.com/downl
| |oad/PDFSPEC13.pdf
Status|UNCONFIRMED |AWAITING_REVIEW
Ever confirmed|0 |1
Assignee|mupdf-***@artifex.com |***@hotmail.com

--- Comment #1 from Sebastian Rasmussen <***@hotmail.com> ---
Proposed commit 7307a7f232b27b22176b8f68364e43e09ce393cc awaiting review.
--
You are receiving this mail because:
You are the QA Contact for the bug.
b***@artifex.com
2017-12-20 13:34:53 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698827

Sebastian Rasmussen <***@hotmail.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|AWAITING_REVIEW |RESOLVED

--- Comment #2 from Sebastian Rasmussen <***@hotmail.com> ---
Fixed in

commit 7307a7f232b27b22176b8f68364e43e09ce393cc
Author: Sebastian Rasmussen <***@gmail.com>
Date: Wed Dec 20 02:32:55 2017 +0100

Bug 698827: Correct reference counting when creating pixmap from pixmap.

Previously the copy had as many reference counts as the original
pixmap which lead to leaks of pixmaps.
--
You are receiving this mail because:
You are the QA Contact for the bug.
Loading...