summaryrefslogtreecommitdiff
path: root/gpdl
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2023-02-08 17:36:51 +0000
committerRobin Watts <Robin.Watts@artifex.com>2023-02-09 09:59:40 +0000
commit536f27b292418cc49e943d7110dc05058e799efd (patch)
tree20fcdec369a0c2c66eb00ced694fdde952c0611c /gpdl
parent2ff71f81b69a02de76b8f0090c76d85f397895df (diff)
downloadghostpdl-536f27b292418cc49e943d7110dc05058e799efd.tar.gz
Fix SEGV seen in overnights with oxford.tif.
For PLANARCONFIG_SEPARATE things, we need to get the 3 components one after another. We were overrunning the end of the buffer. gs -sDEVICE=png16m -o out.png ../tests_private/tiff/oxford.tif
Diffstat (limited to 'gpdl')
-rw-r--r--gpdl/tifftop.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gpdl/tifftop.c b/gpdl/tifftop.c
index 1ad40aaa5..365d75243 100644
--- a/gpdl/tifftop.c
+++ b/gpdl/tifftop.c
@@ -728,6 +728,8 @@ do_impl_process(pl_interp_implementation_t * impl, stream_cursor_read * pr, int
goto fail_decode;
} else if (tiff->tiled) {
tiff->samples = gs_alloc_bytes(tiff->memory, TIFFTileSize(tiff->handle), "tiff_tile");
+ } else if (planar == PLANARCONFIG_SEPARATE) {
+ tiff->samples = gs_alloc_bytes(tiff->memory, tiff->byte_width * tiff->num_comps, "tiff_scan");
} else {
tiff->samples = gs_alloc_bytes(tiff->memory, tiff->byte_width, "tiff_scan");
}
@@ -1002,8 +1004,10 @@ do_impl_process(pl_interp_implementation_t * impl, stream_cursor_read * pr, int
goto fail_decode;
}
} else {
- int span = tiff->byte_width / tiff->num_comps;
+ int span = tiff->byte_width;
byte *in_row = tiff->samples;
+ if (planar != PLANARCONFIG_SEPARATE)
+ span /= tiff->num_comps;
row = tiff->proc_samples;
for (s = 0; s < tiff->num_comps; s++) {
plane_data[s].data = row;