summaryrefslogtreecommitdiff
path: root/source/fitz/memento.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-11-05 14:58:29 +0000
committerRobin Watts <robin.watts@artifex.com>2016-11-05 16:35:36 +0000
commit4ccd0b5268d94668297479da8d7ad5566c8d14f6 (patch)
treea12ff228ec50f4b202e70db0e3b799a1fee8037b /source/fitz/memento.c
parent21368c7c8fb06b2603f35476c3302d8f721e8558 (diff)
downloadmupdf-4ccd0b5268d94668297479da8d7ad5566c8d14f6.tar.xz
Fix Memento bug.
while (i >= 0) { ... i -= 4; } doesn't work well when i is unsigned.
Diffstat (limited to 'source/fitz/memento.c')
-rw-r--r--source/fitz/memento.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/source/fitz/memento.c b/source/fitz/memento.c
index 3e405850..68698f0d 100644
--- a/source/fitz/memento.c
+++ b/source/fitz/memento.c
@@ -973,15 +973,14 @@ static int Memento_Internal_checkFreedBlock(Memento_BlkHeader *b, void *arg)
BlkCheckData *data = (BlkCheckData *)arg;
p = MEMBLK_TOBLK(b); /* p will always be aligned */
- i = b->rawsize - 4;
+ i = b->rawsize;
/* Attempt to speed this up by checking an (aligned) int at a time */
- while (i >= 0) {
+ while (i >= 4) {
if (*(MEMENTO_UINT32 *)p != MEMENTO_FREEFILL_UINT32)
goto mismatch;
p += 4;
i -= 4;
}
- i += 4;
if (i & 2) {
if (*(MEMENTO_UINT16 *)p != MEMENTO_FREEFILL_UINT16)
goto mismatch;