diff options
author | Robin Watts <robin.watts@artifex.com> | 2017-11-08 15:28:47 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2017-11-08 15:30:09 +0000 |
commit | 71a4291781e7db6f0ebdf18acb74ef290110c185 (patch) | |
tree | 646d280ae0bd1bb756afa5d4f6d6c5e1937c4875 /platform/java/mupdf_native.c | |
parent | dd57e3334404381f94ac082bf16f0fa4833e5b9b (diff) | |
download | mupdf-71a4291781e7db6f0ebdf18acb74ef290110c185.tar.xz |
Bug 698616: Fix use after free in Page_textAsHtml
Diffstat (limited to 'platform/java/mupdf_native.c')
-rw-r--r-- | platform/java/mupdf_native.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c index 171a2e8d..4a2274f7 100644 --- a/platform/java/mupdf_native.c +++ b/platform/java/mupdf_native.c @@ -5069,9 +5069,11 @@ FUN(Page_textAsHtml)(JNIEnv *env, jobject self) len = fz_buffer_storage(ctx, buf, &data); arr = (*env)->NewByteArray(env, (jsize)len); + if (arr) + { + (*env)->SetByteArrayRegion(env, arr, 0, (jsize)len, (jbyte *)data); + } fz_drop_buffer(ctx, buf); - if (!arr) return NULL; - (*env)->SetByteArrayRegion(env, arr, 0, (jsize)len, (jbyte *)data); if ((*env)->ExceptionCheck(env)) return NULL; return arr; |