diff options
author | Robin Watts <robin.watts@artifex.com> | 2015-05-15 12:54:59 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2015-05-15 13:44:41 +0100 |
commit | 86f62075afa178b222e6bc0f9fdc79f82d441df0 (patch) | |
tree | 82d0a09ed111cba76f3cfad5331299fb6b5fa32b /source/tools | |
parent | f671c582bd62f65ee036f505d75841c15a5ecec3 (diff) | |
download | mupdf-86f62075afa178b222e6bc0f9fdc79f82d441df0.tar.xz |
Fix bug in pdf_dict_find.
Sebras and Tor spotted that we could get occasional 'warning: cannot seek
backwards' messages. An example command that shows this is:
mutool show pdf_reference17.pdf grep
They further tracked the problem down to the 'sorted' side of the
pdf_dict_find function.
In the binary search, I calculate c to be the comparison value between
pairs of keys. In the case where both keys (names) are in the special
case 'known' range below PDF_OBJ__LIMIT, I use pointer arithmetic for
this. Unfortunately, I was forgetting that the compiler thinks that
pdf_obj *'s are 4 (or 8) bytes in size, so was doing (a-b)/4.
To workaround this I cast both keys to char *'s. This solves the bug.
Thanks to Sebras and Tor for doing the hard work in tracking this down.
Diffstat (limited to 'source/tools')
0 files changed, 0 insertions, 0 deletions