3471 Commits

Author SHA1 Message Date
Riccardo Schirone
272265a4c3
Fix ELF R_X86_64_PLT32 relocation entries patching (#17587) ##bin
* Correctly get the address of the PLT entry for a symbol. If the symbol
was not yet added to the .got.r2 section, then take the first available
address (vaddr), otherwise retrieve it from the hashtable.

* Avoid showing wrong relocations when relocations are already replaced
2020-09-08 09:52:35 +02:00
GustavoLCR
70ab5c8e88
Fix null deref in fuzzed xtr after 080bf4918c461844e76b56832801688137fe624b (#17602) 2020-09-06 14:28:09 +02:00
GustavoLCR
080bf4918c
Fix #17590 - Fix invalid deref in print_types_format (#17592)
Make sure streams are in their proper index for `r_list_get_n` by appending a NULL item when necessary
2020-09-05 19:04:41 +02:00
HoundThe
eca62ba4db
Fix big endian DWARF parsing ##bin (#17503) 2020-09-02 11:01:16 +08:00
Khairul Azhar Kasmiran
580f1e97bd
Propagate parse_ext_opcode() error (#17559) 2020-09-01 00:45:47 +08:00
HoundThe
0b671bc357
Fix resource leaks in dwarf.c and dwarf_process.c (#17521) 2020-08-28 23:18:49 +08:00
junchao-loongson
087e5652b3
Improve iA command for MIPS/ELF ##bin (#17516) 2020-08-28 11:11:34 +02:00
GustavoLCR
bc8f9fd5a8
Fix #9202 - Make main detection for 32bit PE debug build more generic ##bin (#17524) 2020-08-27 12:13:39 +08:00
HoundThe
5845ec39ca
Add function information from DWARF ##anal ##bin (#17434) 2020-08-19 18:21:20 +08:00
Florian Märkl
68a1db448d
Merge everything time-related in r_time.h (#17445) 2020-08-12 18:54:49 +02:00
HoundThe
36817b1ab5
Fix malformed DWARF crash due invalid .debug_str reference ##bin (#17399)
* Fix malformed DWARF crash due invalid `.debug_str` reference resulting in NULL str
* Removed code duplication
2020-08-06 12:22:22 +08:00
Riccardo Schirone
a5d1747e09
Fix #17379 - Avoid buffer overflow while identifying imports (#17387) 2020-08-03 12:31:42 +08:00
GustavoLCR
148cd105de
Fix main detection for debug PE bins ##bin (#17376)
* Fix main detection for debug PE bins
* Add tests for PE main detection
2020-08-03 12:30:11 +08:00
pancake
a5e8cf0c9b
Use more size_t in the MACHO parser ##bin (#17233)
Co-authored-by: pancake <pancake@nopcode.org>
2020-07-27 18:38:02 +08:00
HoundThe
eac93216ec
Improving PDB type information parsing and saving types into SDB (#17226) 2020-07-25 01:40:55 +08:00
HoundThe
1c74f3f729
r_cons_print fix for very large output ##cons (#17343)
* 0x prefix to hex printout
* Change `buffer_size` and `len` to `size_t`
2020-07-24 13:46:30 +08:00
pancake
d441baad62
Fix latest COVs, remove dead code and unnecessary global variables (#17231)
Co-authored-by: pancake <pancake@nopcode.org>
2020-07-22 19:37:31 +08:00
Riccardo Schirone
2d160f2509
Avoid sdb double headers (#17249) ##build
* Avoid duplication of SDB headers in libr/include

SDB is an external project and as such it should live in shlr. However,
for simplicity in dealing with the include flags, the SDB headers were
copied in libr/include as well. This patch just keeps the SDB files
confined in shlr/sdb and make sure various r_* libs use the headers from
there.

* Fix pkgconfig file generation
2020-07-21 10:28:43 +02:00
HoundThe
0e31ba51e6
DWARF - OOB read and multiple incorrect parsing fixes (#17311) 2020-07-20 22:51:45 +02:00
Paul I
2193ec1e20
COFF: fix REL32 relocs handling (#17301) 2020-07-20 11:40:07 +02:00
Paul I
5898c50ad5
Fix double free bug in COFF plugin (#17315) 2020-07-20 09:46:17 +02:00
pancake
52a64537fb
Fix null deref in aao (#17313) 2020-07-20 09:19:52 +02:00
HoundThe
4b8525759f
DWARF - fixed OOB read and memory leak (#17292) 2020-07-17 08:04:58 +08:00
Riccardo Schirone
594b940b7c
Fixes some of the issues in Travis (#17267)
* Do not check with r_return_ if the convention is present

Let's just assume the NULL default in such a case, so that architectures
for which we don't have a defined calling convention can still be
processed somehow by the analysis code. It won't be precise, but it's
better than nothing.

Also add a warning message so users are aware when the calling
convention is not defined.

* Fix oob-read when # is at the end of the cmd string

* Do not set TMPDIR when the new value is the empty string

When TMPDIR is set to empty value, clang+ld behaves in weird ways and
you cannot compile files from within the r2 shell (e.g. when using #!c
or #!cpipe)

* Use meson and add -lasan to pkgconfig files when sanitizer are used
2020-07-16 20:47:30 +08:00
HoundThe
435eb89b67
DWARF - type parsing into RAnalBaseTypes and saving into sdb (#17111) 2020-07-15 18:17:05 +08:00
Paul I
f41310a539
COFF: don't create a map if there are no imported symbols (#17250) ##bin 2020-07-15 10:01:38 +02:00
pancake
2949708687
Fix duplicated entry symbols in macho ##bin (#17277)
* Cleaner attempt to fix the ghost macho symbols ##bin

Co-authored-by: pancake <pancake@nopcode.org>
2020-07-14 19:35:20 -05:00
pancake
6188fa4bd8
Cleanup the ELF parser code a bit ##bin (#17188)
Co-authored-by: pancake <pancake@nopcode.org>
2020-07-10 13:40:15 +08:00
pancake
94a705498a
macho libraries don't have an entrypoint and 0 is not a valid address (#17209) ##bin 2020-07-09 11:27:40 +02:00
GustavoLCR
4b8b609cab
Fix #17186 - Fix unaligned PE section paddr (#17219)
* Fix #17186 - Fix unaligned PE section paddr
* Add test
2020-07-09 17:20:54 +08:00
GustavoLCR
ace6e14f22
Fix #17137 - Support multiple PDB symbol servers with ';' (#17220) ##bin
* Add support for UNC paths as symbol servers on Windows
2020-07-08 20:03:52 +02:00
Alexis Ehret
31fe7b29e3
Add mips_pltgot default value (#17234) 2020-07-07 15:32:09 +02:00
pancake
a988d6c49c
Fix #17221 - DoS when loading a corrupted DEX ##bin (#17225)
Co-authored-by: pancake <pancake@nopcode.org>
2020-07-07 12:04:42 +08:00
Giovanni
d7ddba55b4
Various fixes based on fuzz bins for rabin2 (#17199)
* div by 0

* null deref in r_bin_dex_free

* null deref in get_object

* memset to 0 new capacity if we increase, to avoid garbage in the vector.

* null deref in extract_sections_symbols

* printfs. and moved insert after null deref check.

* moved check before adding the cobj into list.

* moved i definition inside if.

* using r2 macros.

* changed condition to sym_size == 0

* changed condition to if (ret) do smth

* refactoring

* code formatting

* added r_pvector_new_with_len to fix issue with bad usage of RPVector

* using r_pvector_new instead DUP

* Removed check which doesn't make sense and formatting

Co-authored-by: Giovanni Dante Grazioli <giovanni.dantegrazioli@nbs-system.com>
2020-07-06 20:19:25 +08:00
Riccardo Schirone
551c46f753
Print a warning when the entry point is automatically set by r2 ##bin (#17195)
* Use R_LOG_DEBUG instead of eprintf for missing ELF DT
* Remove missing Dynamic tag from rabin2 test
2020-07-06 10:58:33 +02:00
Anton Kochkov
8f0f888215
Add missing ELF DT entries ##bin (#17055)
* Add missing ELF DT entries

* Just add common DT entries in the switch case but do not save them

Co-authored-by: Riccardo Schirone <sirmy15@gmail.com>
2020-07-05 05:44:08 -05:00
pancake
cdd039a38a
Minor optimization in the language detection code in ELF (#17171) ##bin 2020-07-02 14:09:35 +02:00
Paul I
b5ea0d76d0
Add patch_reloc method for COFF plugin ##bin (#16929)
* Add `patch_reloc` method for bin_coff plugin
2020-07-02 12:03:27 +08:00
Alexis Ehret
0b2276e2bb
Add reloc convert PPC ELF (#17191)
* Add patch from @ret2libc
* Add regression test
2020-07-01 15:39:18 +02:00
Les De Ridder
5a09bf6896
Add function for reading PDB from buffer ##bin (#17114) 2020-07-01 11:17:37 +08:00
pancake
d47aed440a
Fix covs from 2020-06-29 (#17184)
* Fix covs from 2020-06-29

* CIDs: 1293553 1408695 1430058 1430059 1430060
1430061 1430062 1430063 1430064 1430065 1430067

* More fixes

Co-authored-by: pancake <pancake@nopcode.org>
2020-07-01 09:33:38 +08:00
pancake
6b7e2a88bc
Fix #17125 - Invalid DEX section size calculation issue ##bin (#17153) 2020-06-30 17:44:40 +02:00
pancake
022ee41717
Optimize and cleanup the dex_get_proto function ##bin (#17154)
* Optimize and cleanup the dex_get_proto function ##bin
* Don't skip unknown argument types
* Early catch an integer overflow
* Add test

Co-authored-by: pancake <pancake@nopcode.org>
2020-06-29 13:07:07 +08:00
pancake
f865daf235
Fix CID 1408682 1429931 1429932 1429933 1429934 (#17159) 2020-06-27 22:45:41 +02:00
pancake
90d368d867
Fix the last 2 covs on pe64 (#17157) 2020-06-27 22:43:14 +02:00
HoundThe
51405f81f4
DWARF: Coverity fixes (#17147) 2020-06-27 11:40:45 +08:00
GustavoLCR
b02ab3d937
Fix missing SEH info and infinite loop for x64 PE (#17113) 2020-06-22 12:45:05 +08:00
Khairul Azhar Kasmiran
8540156f73
Reset strings whenever bin.str.enc changes (#17109) ##bin 2020-06-20 19:43:39 +08:00
HoundThe
914624a921
DWARF .debug_info parsing fix and improvement (#17007)
* Get .debug_info working for DWARF 2, 3
* Fill up missing information in abbrev string table
* Add 64bit dwarf option into debug_info
* Add DWARF4 and DWARF5 forms
* Add unit tests
* added basic test

Co-authored-by: Riccardo Schirone <sirmy15@gmail.com>
2020-06-19 19:25:59 +08:00
GustavoLCR
2f78b9f5df
Fix Thumb symbols bitness for Mach-O ##bin (#17053)
Co-authored-by: pancake <pancake@youterm.com>
2020-06-19 14:47:52 +08:00