diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2022-04-06 09:00:33 -0700 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2022-04-06 09:05:50 -0700 |
commit | 96294656af7d08fa13afbc97cd8fb1f5c03168bd (patch) | |
tree | 649da75dfa5b0ca8f54e58eca66cd7757f0d30b8 /base/gxclread.c | |
parent | ea85ebdf32444580f0880f7710a2bc6b722637c8 (diff) | |
download | ghostpdl-96294656af7d08fa13afbc97cd8fb1f5c03168bd.tar.gz |
Fix SEGV in -ZL handling caused by debug code.
When keeping track of where command blocks start in the
clist offset map (only used for debugging), we can get
confused if we happen to have absorbed exactly all the
bytes in the current buffer (i.e. buffer_offset == 4096).
We used to return -1 in this case which would cause
SEGVs.
Diffstat (limited to 'base/gxclread.c')
-rw-r--r-- | base/gxclread.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/base/gxclread.c b/base/gxclread.c index 03945e81f..b17d5a1ec 100644 --- a/base/gxclread.c +++ b/base/gxclread.c @@ -294,6 +294,12 @@ buffer_segment_index(const stream_band_read_state *ss, uint buffer_offset, uint return i; } } + /* Now cope with the case where we've read exactly to the end of the buffer. + * There might be more data still to come. */ + if (buffer_offset == offset) { + *poffset0 = offset0; + return i-1; + } #ifdef EXTRA_OFFSET_MAP_DEBUGGING dmlprintf1(ss->local_memory, "buffer_segment_index fail: buffer_offset=%d not found\n", buffer_offset); exit(1); |