-
Notifications
You must be signed in to change notification settings - Fork 6k
[android] Fix crash if decode .heic image in 32bit mode android app. #36859
[android] Fix crash if decode .heic image in 32bit mode android app. #36859
Conversation
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
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Change-Id: I7f9b089f7846b03c4b6f91f8cb9d141403e71483
|
cc @jason |
| env, env->CallStaticObjectMethod(g_flutter_jni_class->obj(), | ||
| g_decode_image_method, direct_buffer, | ||
| reinterpret_cast<long>(this))); | ||
| Pointer2Jlong(this))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use reinterpret_cast<jlong> here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. It looks well.
| int height) { | ||
| AndroidImageGenerator* generator = | ||
| reinterpret_cast<AndroidImageGenerator*>(generator_address); | ||
| Jlong2Pointer<AndroidImageGenerator*>(generator_address); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not needed. The original reinterpret_cast<AndroidImageGenerator*> should be safe here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Change-Id: I493a3ecb7cfbf9dc61cd8e69f418635480d4bb6b
|
auto label is removed for flutter/engine, pr: 36859, due to - Please get at least one approved review if you are already a member or two member reviews if you are not a member before re-applying this label. Reviewers: If you left a comment approving, please use the "approve" review action instead. |
|
auto label is removed for flutter/engine, pr: 36859, due to Validations Fail. |
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.