From 556c16d920a94af77bb240392ba0cdecf11159eb Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Tue, 8 Nov 2022 15:34:37 +0100 Subject: [PATCH] WIP: what is this? $ ./build/sanitize/mutool draw -Dst ./x/tiff/segfault/goat.tiff page ./x/tiff/segfault/goat.tiff 1AddressSanitizer:DEADLYSIGNAL ================================================================= ==3377970==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x55dfed459a1b bp 0x7ffecf93ebc0 sp 0x7ffecf93eac0 T0) ==3377970==The signal is caused by a READ memory access. ==3377970==Hint: address points to the zero page. #0 0x55dfed459a1b in fz_convert_pixmap_samples source/fitz/colorspace.c:1421 #1 0x55dfed57bad0 in fz_convert_pixmap source/fitz/pixmap.c:1065 #2 0x55dfed481194 in convert_pixmap_for_painting source/fitz/draw-device.c:1682 #3 0x55dfed482e2c in fz_draw_fill_image source/fitz/draw-device.c:1852 #4 0x55dfed461d34 in fz_fill_image source/fitz/device.c:351 #5 0x55dfed7841a0 in img_run_page source/cbz/muimg.c:105 #6 0x55dfed466fe9 in fz_run_page_contents source/fitz/document.c:642 #7 0x55dfed467358 in fz_run_page source/fitz/document.c:692 #8 0x55dfed3ebbc9 in drawband source/tools/mudraw.c:624 #9 0x55dfed3f0e91 in dodrawpage source/tools/mudraw.c:1125 #10 0x55dfed3f32c1 in drawpage source/tools/mudraw.c:1460 #11 0x55dfed3f3716 in drawrange source/tools/mudraw.c:1499 #12 0x55dfed3f8fcf in mudraw_main source/tools/mudraw.c:2501 #13 0x55dfed3e9736 in main source/tools/mutool.c:152 #14 0x7fae19829209 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 #15 0x7fae198292bb in __libc_start_main_impl ../csu/libc-start.c:389 #16 0x55dfed3e8f60 in _start (/home/sebras/src/mupdf/build/sanitize/mutool+0x21bf60) --- source/fitz/colorspace.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/fitz/colorspace.c b/source/fitz/colorspace.c index 2d87762a9a..67c4e1a8cc 100644 --- a/source/fitz/colorspace.c +++ b/source/fitz/colorspace.c @@ -1426,6 +1426,9 @@ fz_convert_pixmap_samples(fz_context *ctx, const fz_pixmap *src, fz_pixmap *dst, return; } + if (!ss) + ss = fz_default_gray(ctx, default_cs); + fz_try(ctx) { /* Convert indexed into base colorspace. */