diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2022-02-07 11:58:33 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2022-02-07 13:30:23 +0000 |
commit | 9fadaef84ab7b4ab769e8ef97b88e81d0695fa9d (patch) | |
tree | e6db1b5d734c4ac4b8e69527b73d32b3dce58245 | |
parent | 74e9a5d9ab17bb5ee03ec8a941c306ef4f011d49 (diff) | |
download | ghostpdl-9fadaef84ab7b4ab769e8ef97b88e81d0695fa9d.tar.gz |
pdfi: Enforce a minimum stream buffer size for filter streams
See filter_read() in psi/zfilter.c
It appears that various places assume a minimum buffer size of
file_default_buffer_size (2k, currently), and using significantly less than
that can cause stream buffer refills to never be satisfied. This can cause
issues when using and refilling the stream buffer directly (i.e. using
a conbination of sbufavailable/s_process_read_buf/sbufptr/sbufskip.
-rw-r--r-- | pdf/pdf_file.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pdf/pdf_file.c b/pdf/pdf_file.c index 247b0964f..2ed6a2430 100644 --- a/pdf/pdf_file.c +++ b/pdf/pdf_file.c @@ -57,6 +57,8 @@ # include "sjpx.h" #endif +extern const uint file_default_buffer_size; + static void pdfi_close_filter_chain(pdf_context *ctx, stream *s, stream *target); /* Utility routine to create a pdf_c_stream object */ @@ -102,6 +104,9 @@ pdfi_filter_open(uint buffer_size, if (sst == NULL) return_error(gs_error_VMerror); } + if (buffer_size < 128) + buffer_size = file_default_buffer_size; + code = file_open_stream((char *)0, 0, "r", buffer_size, &s, (gx_io_device *)0, (iodev_proc_fopen_t)0, mem); if (code < 0) { |