summaryrefslogtreecommitdiff
path: root/pdf/pdf_xref.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-12-08 12:48:33 +0000
committerRobin Watts <robin.watts@artifex.com>2011-12-08 12:48:33 +0000
commit5ded75b01e51e71aa9d3229b657b5420a28bcb89 (patch)
treed26423faee896bd292686a537ce44c1dcfe35a6b /pdf/pdf_xref.c
parentd5f978f464380be28d67a00a79887d9d15612eff (diff)
downloadmupdf-5ded75b01e51e71aa9d3229b657b5420a28bcb89.tar.xz
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.
Diffstat (limited to 'pdf/pdf_xref.c')
-rw-r--r--pdf/pdf_xref.c6
1 files 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);