From bbd29699598cc56e096ca1badf987f6e661673a1 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 4 Mar 2014 19:54:13 +0000 Subject: 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! --- source/pdf/pdf-interpret.c | 15 +++++++-------- 1 file 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) -- cgit v1.2.3