diff options
author | Robin Watts <robin.watts@artifex.com> | 2014-03-04 19:54:13 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2014-03-04 20:05:04 +0000 |
commit | bbd29699598cc56e096ca1badf987f6e661673a1 (patch) | |
tree | ee43cdae48b63ab461436650453f9432c8b9da28 /source/pdf/pdf-interpret.c | |
parent | b4ad427e758129321166b8fae2e112e01c39a261 (diff) | |
download | mupdf-bbd29699598cc56e096ca1badf987f6e661673a1.tar.xz |
Fix potential leak of pdf_process state.
In the event that an annot is hidden or invisible, the pdf_process
would never be freed. Solve that here.
Thanks to Simon for spotting this!
Diffstat (limited to 'source/pdf/pdf-interpret.c')
-rw-r--r-- | source/pdf/pdf-interpret.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/source/pdf/pdf-interpret.c b/source/pdf/pdf-interpret.c index 1508e829..f0271cf3 100644 --- a/source/pdf/pdf-interpret.c +++ b/source/pdf/pdf-interpret.c @@ -461,17 +461,16 @@ pdf_process_annot(pdf_document *doc, pdf_page *page, pdf_annot *annot, const pdf pdf_csi *csi; int flags; - flags = pdf_to_int(pdf_dict_gets(annot->obj, "F")); - - /* TODO: NoZoom and NoRotate */ - if (flags & (1 << 0)) /* Invisible */ - return; - if (flags & (1 << 1)) /* Hidden */ - return; - csi = pdf_new_csi(doc, cookie, process); fz_try(ctx) { + flags = pdf_to_int(pdf_dict_gets(annot->obj, "F")); + + /* Check not invisible (bit 0) and hidden (bit 1) */ + /* TODO: NoZoom and NoRotate */ + if (flags & ((1 << 0) | (1 << 1))) + break; + csi->process.processor->process_annot(csi, csi->process.state, page->resources, annot); } fz_always(ctx) |