diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-11-05 14:58:29 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-11-05 16:35:36 +0000 |
commit | 4ccd0b5268d94668297479da8d7ad5566c8d14f6 (patch) | |
tree | a12ff228ec50f4b202e70db0e3b799a1fee8037b | |
parent | 21368c7c8fb06b2603f35476c3302d8f721e8558 (diff) | |
download | mupdf-4ccd0b5268d94668297479da8d7ad5566c8d14f6.tar.xz |
Fix Memento bug.
while (i >= 0) { ... i -= 4; } doesn't work well when i is unsigned.
-rw-r--r-- | source/fitz/memento.c | 5 |
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; |