From 811af8ef3627ae55bab21280b54a222a1ad3c608 Mon Sep 17 00:00:00 2001 From: toneyzeng Date: Tue, 25 Oct 2022 03:47:50 +0800 Subject: [PATCH] [android] Fix crash if decode .heic image in 32bit mode android app. (flutter/engine#36859) * [android] Fix crash if decode .heic image in 32bit mode android app. The type |long| is equal to int32_t in 32bit app, but int64_t in 64bit app. The type |jlong| is always equal to int64_t. CallStaticObjectMethod uses "J" to request a jlong type which needs 8 byte data but given |long| value which provides 4 byte data in 32bit mode will trigger java value error and at last a wrong pointer to AndroidImageGenerator object. Change-Id: I38cc46adc45d8bf3e4eb35e6e904e58ee0682d97 * fix compile error Change-Id: I7f9b089f7846b03c4b6f91f8cb9d141403e71483 * use reinterpret_cast directly. Change-Id: I493a3ecb7cfbf9dc61cd8e69f418635480d4bb6b --- .../flutter/shell/platform/android/android_image_generator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/src/flutter/shell/platform/android/android_image_generator.cc b/engine/src/flutter/shell/platform/android/android_image_generator.cc index d3bb70f60d..0222fd5e24 100644 --- a/engine/src/flutter/shell/platform/android/android_image_generator.cc +++ b/engine/src/flutter/shell/platform/android/android_image_generator.cc @@ -106,7 +106,7 @@ void AndroidImageGenerator::DoDecodeImage() { auto bitmap = std::make_unique>( env, env->CallStaticObjectMethod(g_flutter_jni_class->obj(), g_decode_image_method, direct_buffer, - reinterpret_cast(this))); + reinterpret_cast(this))); FML_CHECK(fml::jni::CheckException(env)); if (bitmap->is_null()) {