From 9148cbdc6649ded26c21f82336ec8e693cea5155 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sat, 25 Jul 2015 15:46:58 +0200 Subject: 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. --- source/pdf/pdf-object.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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]); -- cgit v1.2.3