anestisb / vdexExtractor

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

compact_dex_converter crashing when verifying some framework converted files #31

Open anestisb opened 6 years ago

anestisb commented 6 years ago
$ gdb /tmp/vdexExtractor/tools/deodex/hostTools/Linux/api-API_28/bin/compact_dex_converter
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /tmp/vdexExtractor/tools/deodex/hostTools/Linux/api-API_28/bin/compact_dex_converter...done.
(gdb) run -v -w . old/vdexExtractor_decompiled/boot-core-oj/decompiled/boot-core-oj_classes.cdex
Starting program: /tmp/vdexExtractor/tools/deodex/hostTools/Linux/api-API_28/bin/compact_dex_converter -v -w . old/vdexExtractor_decompiled/boot-core-oj/decompiled/boot-core-oj_classes.cdex
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Opened 'old/vdexExtractor_decompiled/boot-core-oj/decompiled/boot-core-oj_classes.cdex', DEX version '001'
compact_dex_converter W 09-08 12:27:03 19161 19161 dex_file_verifier.cc:377] Ignoring bad checksum (c6c4c142, expected be17fbb4)
compact_dex_converter F 09-08 12:27:03 19161 19161 dexlayout.cc:1950] Check failed: output_dex_file != nullptr Failed to re-open output file:Failure to verify dex file 'memory mapped file for old/vdexExtractor_decompiled/boot-core-oj/decompiled/boot-core-oj_classes.cdex': Method may have only one of public/protected/private, Ljava/lang/Object;.identityHashCode: f

Program received signal SIGSEGV, Segmentation fault.
art::Mutex::ExclusiveLock (this=0x0, self=0x0) at art/runtime/base/mutex.cc:435
435 art/runtime/base/mutex.cc: No such file or directory.
(gdb) bt
#0  art::Mutex::ExclusiveLock (this=0x0, self=0x0) at art/runtime/base/mutex.cc:435
#1  0x00007ffff7bf98ef in art::MutexLock::MutexLock (self=0x0, mu=..., this=<optimized out>) at art/runtime/base/mutex.h:513
#2  art::Runtime::Abort (
    msg=0x55555555d9e0 "Check failed: output_dex_file != nullptr Failed to re-open output file:Failure to verify dex file 'memory mapped file for old/vdexExtractor_decompiled/boot-core-oj/decompiled/boot-core-oj_classes.cdex"...) at art/runtime/runtime.cc:545
#3  0x00007ffff7fee720 in std::__1::function<void (char const*)>::operator()(char const*) const (this=<optimized out>,
    __arg=0x55555555d9e0 "Check failed: output_dex_file != nullptr Failed to re-open output file:Failure to verify dex file 'memory mapped file for old/vdexExtractor_decompiled/boot-core-oj/decompiled/boot-core-oj_classes.cdex"...) at external/libcxx/include/functional:1916
#4  android::base::LogMessage::~LogMessage (this=0x7fffffffd810) at system/core/base/logging.cpp:458
#5  0x00007ffff7fb6a58 in art::DexLayout::ProcessDexFile (this=0x7fffffffda80, file_name=0x7ffff5005010 "dex\n039", dex_file=0x55555555d810,
    dex_file_index=<optimized out>, dex_container=<optimized out>, error_msg=<optimized out>) at art/dexlayout/dexlayout.cc:1950
#6  0x0000555555556f54 in art::ProcessFile (file_name=0x7fffffffdfa4 "old/vdexExtractor_decompiled/boot-core-oj/decompiled/boot-core-oj_classes.cdex",
    out_file=<optimized out>, output_dex_directory=<optimized out>, verify_output_file=<optimized out>) at art/dexlayout/compact_dex_converter_main.cc:111
#7  art::DexlayoutDriver (argc=5, argv=<optimized out>) at art/dexlayout/compact_dex_converter_main.cc:235
#8  0x0000555555557ead in main (argc=5, argv=0x7fffffffdc98) at art/dexlayout/compact_dex_converter_main.cc:252
anestisb commented 6 years ago

Issue appears to be reproducible only when using the optional verify flag (-v). Thus not a priority at the moment. However, will be soon fixed since the verifier is useful to track issues when converting CompactDex files. Until resolved, the verifier of the dexdump2 ART utility can be used against the output converted file.