summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-03-06 21:33:46 +0000
committerRobin Watts <robin.watts@artifex.com>2012-03-06 21:34:50 +0000
commita14bb1748d3827e542fbff47488f67e0dfa3b15d (patch)
treea96dfc85bedd04019eadb58fcfeb86ef52f7b6ae
parentdae93920d513842f6c9a96e833043f3f6f8e0681 (diff)
downloadmupdf-a14bb1748d3827e542fbff47488f67e0dfa3b15d.tar.xz
Fix memory corruption
I'd foolishly removed a check in the previous commit that was needed. refs can be < 0 for static resources.
-rw-r--r--fitz/res_store.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fitz/res_store.c b/fitz/res_store.c
index cc635052..df9c6e33 100644
--- a/fitz/res_store.c
+++ b/fitz/res_store.c
@@ -274,7 +274,8 @@ fz_store_item(fz_context *ctx, void *key, void *val_, unsigned int itemsize, fz_
}
}
/* Now we can never fail, bump the ref */
- val->refs++;
+ if (val->refs > 0)
+ val->refs++;
/* Regardless of whether it's indexed, it goes into the linked list */
item->next = store->head;
if (item->next)