Skip to content

Fix JNI parameter type in nativeReplaceImageByName causing SIGSEGV on armeabi-v7a - #3594

Merged
shlzxjp merged 1 commit into
mainfrom
bugfix/markffan_jni_long
Jul 20, 2026
Merged

Fix JNI parameter type in nativeReplaceImageByName causing SIGSEGV on armeabi-v7a#3594
shlzxjp merged 1 commit into
mainfrom
bugfix/markffan_jni_long

Conversation

@CodeJhF

@CodeJhF CodeJhF commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

问题

Java_org_libpag_PAGFile_nativeReplaceImageByNameimageObject 参数在 C++ 侧被声明为原生 long 类型,但 Java 侧声明为 long(对应 JNI 的 jlong,固定 64 位)。

在 armeabi-v7a(32 位 ABI)上,C++ 的 long 只有 32 位,与 JNI 期望的 64 位不匹配,导致传入的 nativeContext 指针被截断、参数错位,进而 reinterpret_cast 得到非法指针,触发 SIGSEGV 崩溃。64 位 ABI 下 long 恰好是 64 位,因此问题未暴露。

修改

将参数类型由 long 改为 jlong,与同文件中的 nativeReplaceImage 保持一致。

修复 #3590

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.56%. Comparing base (4a8fb4f) to head (4f8a4c0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3594      +/-   ##
==========================================
- Coverage   82.57%   82.56%   -0.01%     
==========================================
  Files         707      707              
  Lines       91382    91382              
  Branches    25871    25871              
==========================================
- Hits        75461    75453       -8     
  Misses      10437    10437              
- Partials     5484     5492       +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shlzxjp
shlzxjp merged commit 9f25435 into main Jul 20, 2026
9 checks passed
@shlzxjp
shlzxjp deleted the bugfix/markffan_jni_long branch July 20, 2026 07:43
CodeJhF added a commit that referenced this pull request Jul 20, 2026
CodeJhF added a commit that referenced this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants