Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@toneyzeng
Copy link
Contributor

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.

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
@flutter-dashboard
Copy link

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
@chinmaygarde
Copy link
Member

cc @jason

env, env->CallStaticObjectMethod(g_flutter_jni_class->obj(),
g_decode_image_method, direct_buffer,
reinterpret_cast<long>(this)));
Pointer2Jlong(this)));
Copy link
Member

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

Copy link
Contributor Author

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);
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Change-Id: I493a3ecb7cfbf9dc61cd8e69f418635480d4bb6b
@jason-simmons jason-simmons added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 24, 2022
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 24, 2022
@auto-submit
Copy link
Contributor

auto-submit bot commented Oct 24, 2022

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-submit
Copy link
Contributor

auto-submit bot commented Oct 24, 2022

auto label is removed for flutter/engine, pr: 36859, due to Validations Fail.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants