diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-03-06 21:33:46 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-03-06 21:34:50 +0000 |
commit | a14bb1748d3827e542fbff47488f67e0dfa3b15d (patch) | |
tree | a96dfc85bedd04019eadb58fcfeb86ef52f7b6ae | |
parent | dae93920d513842f6c9a96e833043f3f6f8e0681 (diff) | |
download | mupdf-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.c | 3 |
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) |