summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2015-07-25 15:46:58 +0200
committerSebastian Rasmussen <sebras@gmail.com>2015-07-27 14:53:21 +0200
commit9148cbdc6649ded26c21f82336ec8e693cea5155 (patch)
tree554987e8c1189d74d10f61bc908c9554a8f67cda /source/pdf
parentacecda5931657d155cba9f3c56e209693f02a086 (diff)
downloadmupdf-9148cbdc6649ded26c21f82336ec8e693cea5155.tar.xz
Correctly compare PDF names with null, true and false.
Commit f533104 introduced optimized handling of pdf names, null, true and false. That commit handles most object types correctly in pdf_objcmp() but it does not correctly handle comparisons such as pdf_objcmp("/Crypt", "true") or pdf_objcmp("null", "/Crypt"). Fixes one issue from bug 696012.
Diffstat (limited to 'source/pdf')
-rw-r--r--source/pdf/pdf-object.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/pdf/pdf-object.c b/source/pdf/pdf-object.c
index c17d982c..3d795cfe 100644
--- a/source/pdf/pdf-object.c
+++ b/source/pdf/pdf-object.c
@@ -412,7 +412,8 @@ pdf_objcmp(fz_context *ctx, pdf_obj *a, pdf_obj *b)
{
if (b < PDF_OBJ_NAME__LIMIT)
return a != b;
-
+ if (b < PDF_OBJ__LIMIT)
+ return 1;
if (b->kind != PDF_NAME)
return 1;
return strcmp(NAME(b)->n, PDF_NAMES[(intptr_t)a]);
@@ -420,6 +421,8 @@ pdf_objcmp(fz_context *ctx, pdf_obj *a, pdf_obj *b)
if (b < PDF_OBJ_NAME__LIMIT)
{
+ if (a < PDF_OBJ__LIMIT)
+ return 1;
if (a->kind != PDF_NAME)
return 1;
return strcmp(NAME(a)->n, PDF_NAMES[(intptr_t)b]);