diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-08-06 02:29:03 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-08-06 02:29:03 +0200 |
commit | 7926d3cbd583e45e59532fa473713e7d54424811 (patch) | |
tree | 5a222ac3b125c011b2eae2a8d6a4e436a91efde9 /pdf | |
parent | d53ebe66b7b13b13e4afced80a4c113d9d578c8f (diff) | |
download | mupdf-7926d3cbd583e45e59532fa473713e7d54424811.tar.xz |
Allocate a re-entrant safe buffer for interpreting content streams.
Fix bug 692282.
Diffstat (limited to 'pdf')
-rw-r--r-- | pdf/pdf_interpret.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c index f10f6c83..e32b1ab8 100644 --- a/pdf/pdf_interpret.c +++ b/pdf/pdf_interpret.c @@ -2224,11 +2224,13 @@ pdf_run_stream(pdf_csi *csi, fz_obj *rdb, fz_stream *file, char *buf, int buflen static fz_error pdf_run_buffer(pdf_csi *csi, fz_obj *rdb, fz_buffer *contents) { - fz_stream *file; fz_error error; - file = fz_open_buffer(contents); - error = pdf_run_stream(csi, rdb, file, csi->xref->scratch, sizeof csi->xref->scratch); + int len = sizeof csi->xref->scratch; + char *buf = fz_malloc(len); /* we must be re-entrant for type3 fonts */ + fz_stream *file = fz_open_buffer(contents); + error = pdf_run_stream(csi, rdb, file, buf, len); fz_close(file); + fz_free(buf); if (error) return fz_rethrow(error, "cannot parse content stream"); return fz_okay; |