Fix gcc compilation error #89
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix GCC compilation error with variable length array parameter
Summary
This PR fixes a compilation error that occurs when building vdexExtractor with newer GCC versions. The error is caused by a mismatch between the function declaration and implementation for
dexInstr_getVarArgs.Problem
When compiling with
./make.sh gcc, the build fails with:Root Cause
The header file declares
void dexInstr_getVarArgs(u2 *, u4[]);but the implementation usesvoid dexInstr_getVarArgs(u2 *code_ptr, u4 arg[kMaxVarArgRegs]). Newer GCC versions treat this mismatch as an error when using-Werrorflag.Solution
Update the function declaration in
src/dex_instruction.hto match the implementation:Before:
After:
Changes Made
src/dex_instruction.hTesting
✅ Compilation: Successfully compiles with
./make.sh gcc✅ Functionality: All existing functionality maintained
✅ Compatibility: No breaking changes to the API
✅ Standards: Passes all compilation flags including
-Wall -Wextra -WerrorImpact
Environment Tested
-Werror=vla-parametersupport./make.sh gccRelated
This fix addresses compilation issues that prevent users from building vdexExtractor on modern systems, improving the tool's accessibility for Android security research and reverse engineering.
Note: This is a safe, backward-compatible change that only affects the function declaration to match the existing implementation.