From 7926d3cbd583e45e59532fa473713e7d54424811 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 6 Aug 2011 02:29:03 +0200 Subject: Allocate a re-entrant safe buffer for interpreting content streams. Fix bug 692282. --- pdf/pdf_interpret.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'pdf') 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; -- cgit v1.2.3