From 063a723b9fa50200192b01ba976ecd551461a8dc Mon Sep 17 00:00:00 2001 From: Matt Holgate Date: Fri, 27 Jun 2014 12:30:39 +0100 Subject: Fix #695217 - don't allow annotation of encrypted PDFs --- platform/android/jni/mupdf.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'platform/android/jni') diff --git a/platform/android/jni/mupdf.c b/platform/android/jni/mupdf.c index 927fef3c..04f1ceff 100644 --- a/platform/android/jni/mupdf.c +++ b/platform/android/jni/mupdf.c @@ -514,6 +514,22 @@ JNI_FN(MuPDFCore_fileFormatInternal)(JNIEnv * env, jobject thiz) return (*env)->NewStringUTF(env, info); } +JNIEXPORT jboolean JNICALL +JNI_FN(MuPDFCore_isUnencryptedPDFInternal)(JNIEnv * env, jobject thiz) +{ + globals *glo = get_globals_any_thread(env, thiz); + if (glo == NULL) + return JNI_FALSE; + + pdf_document *idoc = pdf_specifics(glo->doc); + if (idoc == NULL) + return JNI_FALSE; // Not a PDF + + int cryptVer = pdf_crypt_version(idoc); + return (cryptVer == 0) ? JNI_TRUE : JNI_FALSE; +} + + JNIEXPORT void JNICALL JNI_FN(MuPDFCore_gotoPageInternal)(JNIEnv *env, jobject thiz, int page) { -- cgit v1.2.3