Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fileinfo crashes in retdec::cpdetect::Heuristics::getDwarfInfo() when obtaining DWARF info via LLVM #744

Closed
s3rvac opened this issue Apr 20, 2020 · 1 comment

Comments

@s3rvac
Copy link
Member

s3rvac commented Apr 20, 2020

retdec-fileinfo crashes in retdec::cpdetect::Heuristics::getDwarfInfo() when obtaining DWARF info via LLVM.

Input

Run

$ retdec-fileinfo FILE

where FILE is:

  • 48AD68D1E4A88F0031DC875E6187DC9E7D60D8B86170CDE6E1BA4F025C74E6E3

  • 7AC51130B67B633A88FF44406B5E8BCA27980E2CCE12E8319527E818D4796DFE

  • B824D67C4895B878C252273027FF95F5D7CDCCF789C462D1CEFEAD115DEB5661

  • FC3FCF0E2CEE773590849D2D7DF61BE0BDCEE0400E8F54371333C70D5640079D

  • 30023B327FD15B8D985F24C861ADAB4B75D5803D7D251D431829C47B0EA4DB88

  • 0AAD1DC8F22106FB2AF8D2D474649A251B45E08D7754D1F58493B69070E459DF

Output

Segmentation fault

Expected output

retdec-fileinfo does not crash when analyzing the file.

Output from valgrind

Invalid read of size 4
   at 0x6F08D0: llvm::DWARFAbbreviationDeclarationSet::getAbbreviationDeclaration(unsigned int) const (in retdec-fileinfo)
   by 0x73A687: llvm::DWARFDebugInfoEntry::extractFast(llvm::DWARFUnit const&, unsigned int*, llvm::DWARFDataExtractor const&, unsigned int, unsigned int) (in retdec-fileinfo)
   by 0x715D35: llvm::DWARFUnit::extractDIEsToVector(bool, bool, std::vector<llvm::DWARFDebugInfoEntry, std::allocator<llvm::DWARFDebugInfoEntry> >&) const (in retdec-fileinfo)
   by 0x717F1A: llvm::DWARFUnit::extractDIEsIfNeeded(bool) (in retdec-fileinfo)
   by 0x48CCE5: llvm::DWARFUnit::getUnitDIE(bool) (DWARFUnit.h:382)
   by 0x48AA93: retdec::cpdetect::Heuristics::getDwarfInfo() (heuristics.cpp:697)
   by 0x48BF6B: retdec::cpdetect::Heuristics::getCommonToolsHeuristics() (heuristics.cpp:876)
   by 0x48C290: retdec::cpdetect::Heuristics::getAllHeuristics() (heuristics.cpp:953)
   by 0x47AF48: retdec::cpdetect::CompilerDetector::getAllHeuristics() (compiler_detector.cpp:332)
   by 0x47CA51: retdec::cpdetect::CompilerDetector::getAllCompilers() (compiler_detector.cpp:496)
   by 0x47D0B4: retdec::cpdetect::CompilerDetector::getAllInformation() (compiler_detector.cpp:556)
   by 0x1D212C: retdec::fileinfo::FileDetector::getCompilerInformation() (file_detector.cpp:77)
 Address 0x4 is not stack'd, malloc'd or (recently) free'd

Configuration

  • Commit: bc01f3b (current master)
  • 64b Arch Linux, GCC 9.2.0, Debug build of RetDec
@PeterMatula
Copy link
Collaborator

Fixed in LLVM, updated RetDec reference, and added 2 binaries to nightly tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants