From 5ded75b01e51e71aa9d3229b657b5420a28bcb89 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Thu, 8 Dec 2011 12:48:33 +0000 Subject: Fix possible NULL dereference in pdf_resolve_indirect The code was dereferencing xref to get ctx before checking whether it was NULL or not. Simple fix to move the test up a bit. --- pdf/pdf_xref.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c index 501db660..3efd28be 100644 --- a/pdf/pdf_xref.c +++ b/pdf/pdf_xref.c @@ -1003,11 +1003,11 @@ pdf_resolve_indirect(fz_obj *ref) if (fz_is_indirect(ref)) { pdf_xref *xref = fz_get_indirect_xref(ref); - fz_context *ctx = xref->ctx; - int num = fz_to_num(ref); - int gen = fz_to_gen(ref); if (xref) { + int num = fz_to_num(ref); + int gen = fz_to_gen(ref); + fz_context *ctx = xref->ctx; fz_try(ctx) { pdf_cache_object(xref, num, gen); -- cgit v1.2.3