diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-11-18 13:02:01 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-11-21 11:11:46 +0100 |
commit | bff572a7365209f36a16951296384974c80ad3d5 (patch) | |
tree | 7d63479831c8edc24bc5933a1ef61c376a8dd6b2 /platform/android | |
parent | ac6ebbe38e6edb6074b1b73707770a9a4e9979b8 (diff) | |
download | mupdf-bff572a7365209f36a16951296384974c80ad3d5.tar.xz |
Harden viewers against failures when loading outlines.
Ignore invalid page references in outlines.
This was shown by a file that had [null 0 0 1] as a link dest.
Attempting to parse that threw an error, which caused the whole
outline load to fail.
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/viewer/jni/mupdf.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/platform/android/viewer/jni/mupdf.c b/platform/android/viewer/jni/mupdf.c index 581da497..55bcfb7a 100644 --- a/platform/android/viewer/jni/mupdf.c +++ b/platform/android/viewer/jni/mupdf.c @@ -1212,7 +1212,11 @@ JNI_FN(MuPDFCore_hasOutlineInternal)(JNIEnv * env, jobject thiz) { globals *glo = get_globals(env, thiz); fz_context *ctx = glo->ctx; - fz_outline *outline = fz_load_outline(ctx, glo->doc); + fz_outline *outline; + fz_try(ctx) + outline = fz_load_outline(ctx, glo->doc); + fz_catch(ctx) + outline = NULL; fz_drop_outline(glo->ctx, outline); return (outline == NULL) ? JNI_FALSE : JNI_TRUE; @@ -1236,7 +1240,10 @@ JNI_FN(MuPDFCore_getOutlineInternal)(JNIEnv * env, jobject thiz) ctor = (*env)->GetMethodID(env, olClass, "<init>", "(ILjava/lang/String;I)V"); if (ctor == NULL) return NULL; - outline = fz_load_outline(ctx, glo->doc); + fz_try(ctx) + outline = fz_load_outline(ctx, glo->doc); + fz_catch(ctx) + outline = NULL; nItems = countOutlineItems(outline); arr = (*env)->NewObjectArray(env, |