anestisb / vdexExtractor

Tool to decompile & extract Android Dex bytecode from Vdex files
Apache License 2.0
1k stars 214 forks source link

Segmentation fault #26

Closed Furniel closed 6 years ago

Furniel commented 6 years ago

Got segmentation fault on SecFactoryPhoneTest.vdex(vdex 0.10 from Samsung galaxy note 9, android 8.1 rom)

[INFO] Processing 1 file(s) from SecFactoryPhoneTest.vdex
[DEBUG] [2836] 2018/08/30 19:44:12 (vdexExtractor.c:194 main) Processing 'SecFactoryPhoneTest.vdex'
[DEBUG] [2836] 2018/08/30 19:44:12 (vdex_api.c:41 vdexApi_initEnv) Initializing environment for Vdex version '010'
------ Vdex Header Info ------
magic header & version      : vdex-010
number of dex files         : 1 (1)
dex size (overall)          : 9d28 (40232)
verifier dependencies size  : 2b8 (696)
verifier dependencies offset: 9d44 (40260)
quickening info size        : 4 (4)
quickening info offset      : 9ffc (40956)
dex files info              :
  [0] location checksum : 1d2ba12a (489398570)
---- EOF Vdex Header Info ----
[DEBUG] [2836] 2018/08/30 19:44:12 (vdex/vdex_010.c:75 vdex_010_GetNextDexFileData) Processing first Dex file at offset:0x1c
[DEBUG] [2836] 2018/08/30 19:44:12 (dex.c:351 dex_isValidDex) Dex version '037' detected
Segmentation fault (core dumped)

SecFactoryPhoneTest.zip

bursoft-git commented 6 years ago

it seems that everything is fine with latest commit https://github.com/anestisb/vdexExtractor/commit/f5a2e4a2b70d6e7fa13a8ad2c1c3f24f97c8e093

C:\BatchApkTool\bin\bin64>vdexExtractor.exe -i SecFactoryPhoneTest.vdex [INFO] Processing 1 file(s) from SecFactoryPhoneTest.vdex [INFO] 1 out of 1 Vdex files have been processed [INFO] 1 Dex files have been extracted in total [INFO] Extracted Dex files are available in '.'

Furniel commented 6 years ago

@bursoft-git I've tested windows(cygwin) x86 and x64 and linux x64 builds (gcc was used on all platforms) and getting same error in all cases: Cygwin dump: vdexExtractor.exe.stackdump.zip Linux dump: core.zip

anestisb commented 6 years ago

Thanks for reporting. Fixed in https://github.com/anestisb/vdexExtractor/commit/957d12054196e255bb97c93ba0c8fc0099dc5d60.

anestisb commented 6 years ago

@bursoft-git depending on the memory layout the bug might not always trigger a crash (check commit description for more info).