summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-07-04 16:12:02 +0100
committerRobin Watts <robin.watts@artifex.com>2012-07-05 17:10:00 +0100
commit15fc25b0055dbdbfaf4257ac908d43fd5a2da19d (patch)
tree5f4c9969900bcc1a5728da39cc74f60753f3c1b9 /fitz
parentfdda884c097d52e687ddbbe1fdafb375caf45165 (diff)
downloadmupdf-15fc25b0055dbdbfaf4257ac908d43fd5a2da19d.tar.xz
Cope with stray returns at the start of a JPEG stream.
Acrobat seems to cope, we should too. See normal_439.pdf for an example.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/filt_dctd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fitz/filt_dctd.c b/fitz/filt_dctd.c
index 23744f01..1b588d2a 100644
--- a/fitz/filt_dctd.c
+++ b/fitz/filt_dctd.c
@@ -101,12 +101,17 @@ read_dctd(fz_stream *stm, unsigned char *buf, int len)
if (!state->init)
{
+ int c;
cinfo->client_data = state;
cinfo->err = &state->errmgr;
jpeg_std_error(cinfo->err);
cinfo->err->error_exit = error_exit;
jpeg_create_decompress(cinfo);
+ /* Skip over any stray returns at the start of the stream */
+ while ((c = fz_peek_byte(state->chain)) == '\n' || c == '\r')
+ (void)fz_read_byte(state->chain);
+
cinfo->src = &state->srcmgr;
cinfo->src->init_source = init_source;
cinfo->src->fill_input_buffer = fill_input_buffer;