Commit Graph

3762 Commits

Author SHA1 Message Date
pancake
07be57f33a
Fix loading symbols from nested ELF ##bin (#18615) 2021-04-21 20:25:04 +02:00
pancake
be248ddc1b
Fix some Leaks in Dex (#18613)
Co-authored-by: Florian Märkl <info@florianmaerkl.de>
2021-04-21 18:52:47 +02:00
pancake
580ebc8edc
Fix oobreads in the PE SEH parser (#18611) 2021-04-21 15:21:55 +02:00
pancake
bfcc61b48f
Fix OOB read crash in dex parser (#18609) 2021-04-21 13:24:50 +02:00
Francesco Tamagni
52b4598d11 Honor value_add when estimating dyldcache slide ##bin
macOS caches have `value_add` set to a non-zero value, and
`estimate_slide` wasn't taking it into account resultin in a wrong side
estimation.
2021-04-17 20:14:36 +02:00
pancake
17a160cc77 Parse the symbols from the ELF .gnu_debugdata section ##bin 2021-04-11 05:32:41 +02:00
meme
0745702234
Support x86_64 and macOS dyld caches (#18570) ##bin
Co-authored-by: meme <meme@users.noreply.github.com>
2021-04-11 04:09:20 +02:00
pancake
d6e91498f2
Fix wrong demangling of tiff swab16 bit data ##bin (#18566) 2021-04-11 03:30:18 +02:00
pancake
3f7d6b1760
Use r_bin_import_free() as <free> cb for imports list (#893) ##bin (#18563) 2021-04-11 01:49:00 +02:00
pancake
ab295f224a
Improve python disassembler and binary parser ##bin (#18561)
* Fix segfault when loading pyc9 file
* Lowercase all instructions (user can later decide asm.ucase)
* Use 1 space, not 20, between instruction and arg
* Detect pyc3.9 bins, not loading properly yet
2021-04-11 01:38:49 +02:00
pancake
f0cafe9198
Fix large loading times when parsing encrypted/fuzzed macho ##bin (#18547)
* Strip flags from entsize when checking bounds

Co-authored-by: pancake <pancake@nopcode.org>
Co-authored-by: Francesco Tamagni <mrmacete@protonmail.ch>
2021-04-08 01:55:48 +02:00
pancake
fcf3ad1e1d
Do not consider ELFs with .gnu_debugdata section as stripped ##bin (#18548)
Co-authored-by: pancake <pancake@nopcode.org>
2021-04-08 01:55:21 +02:00
Francesco Tamagni
f47804f3e9
Fix coverity issue in Mach-O format (#18546) 2021-04-07 12:28:56 +02:00
pancake
e5248e97ed
Fix #18511 - Add dwarf info in pdj ##disasm 2021-04-04 19:13:31 +02:00
pancake
4c8aa2bf2e
Fix last covs I got by mail (#18531) 2021-04-03 03:50:08 +02:00
Francesco Tamagni
3b9f63e506 Fix NULL dereference 2021-04-01 21:48:39 +02:00
Francesco Tamagni
7e2941d017 Fix Mach-O related coverity issues ##bin 2021-04-01 21:48:39 +02:00
Francesco Tamagni
c4bbe4996c
Fix coverity issues in xnu kernelcache ##bin (#18514) 2021-03-30 16:00:59 +02:00
pancake
a7c08c15ce Don't scream out WARNINGs, capitalizing it is enough 2021-03-19 11:02:54 +01:00
pancake
a980a1a0b0
Fix asan crash in DEX with big negative type sections (#18492) 2021-03-18 03:26:08 +01:00
pancake
93b4f34b84
Fix ASAN crash when allocating more relocs than the filesize ##bin (#18482)
* Reproducer: r2 elf7
2021-03-16 12:49:48 +01:00
pancake
08fe19ceb7 Fix asan crash found in r2_hoobr_dex_loadcode ##bin 2021-03-16 12:49:12 +01:00
pancake
e3b5991774 Fix oobread bug in r_str_(ndup|nlen) APIs spotted by ASAN in SMD parser ##bin 2021-03-15 12:26:01 +01:00
Paul I
1e8a80c553 Set free method for relocs on mdmp and coff 2021-03-15 06:09:21 +01:00
pancake
d15d321366 Remove unused variable 2021-03-15 02:24:16 +01:00
pancake
894bc43ea9 Use more r_str_ncpy and improve it to not alloc beyond nullbyte ##api 2021-03-15 02:24:16 +01:00
pancake
c5e45f935d Fix minor memleak on fail for macho 2021-03-15 02:24:16 +01:00
Florian M"arkl
b24dfd8e63 Fix UAF in rz_bin_reset_strings() ##bin 2021-03-15 02:24:16 +01:00
Khairul Azhar Kasmiran
ded1bafab3 Fix some uninitialized and minor memleak issues 2021-03-15 02:24:16 +01:00
Paul I
902d12b5ec Free objects allocated by rz_syscall_get() 2021-03-15 02:24:16 +01:00
Khairul Azhar Kasmiran
621f90752b Fix overflow in dcpu16 and uninitialized warning in wasm 2021-03-15 02:24:16 +01:00
wargio
8b1037a9a1 null argument issues 2021-03-15 01:48:59 +01:00
Alexis Ehret
f48729acd5 Random null deref and more size_t fixes 2021-03-15 01:48:59 +01:00
condret
eb48818342 Rename r_io_map_get to r_io_map_get_at ##io 2021-03-12 17:56:46 +01:00
pancake
f566769dc0
Minor ELF cleanup, using more size_t and ut64.max instead of 0 ##bin (#18389) 2021-03-01 20:57:48 +01:00
Francesco Tamagni
5535d96399
Add Support for new CoreSymbolication element format ##bin (#18392) 2021-03-01 10:44:44 +01:00
pancake
a08c89eb10 Fix warnings found on 32bit and --with-check-levels=0 2021-02-27 01:01:22 +01:00
pancake
00a0d05e68
Fix warning message when loading files with relocs ##bin (#18379) 2021-02-23 01:09:27 +01:00
pancake
0a155498bc Fix c89 warnings 2021-02-11 16:01:48 +01:00
Francesco Tamagni
69d1db9e2e
Fix dead nested assignment libr/bin/format/mach0/mach0.c (#18338)
Co-authored-by: Alexis Ehret <08a@riseup.net>
2021-02-08 23:44:57 +01:00
Francesco Tamagni
4c572bca1d
Replace HtPP with more suitable types in bin_dyldcache.c (#518) (#18339)
Co-authored-by: Paul I <pelijah@users.noreply.github.com>
2021-02-08 23:41:26 +01:00
Alexis Ehret
43aadf109d Random dead code cleanup 2021-02-06 03:30:53 +01:00
Paul I
76fa5a003f Use HtUP for storing cache of class methods ##bin 2021-02-06 03:30:53 +01:00
pancake
306d6aa996 Fix few warnings and sort w command switch 2021-01-31 19:51:25 +01:00
ChD1
580bdf2c52
Fix some bugs in dex.c, marshal.c, panels.c and other code optimization and fixel (#18297) 2021-01-27 10:53:50 +01:00
pancake
eb09312b83
Fix iCj for mach0 ##bin (#18298) 2021-01-27 00:34:14 +01:00
Kamil Rytarowski
9d761f6a88
Avoid array subscript type issues (#18295)
Cast char to unsigned char for standard reasons and security purposes.

Fixes build issues on NetBSD.
2021-01-26 13:08:58 +01:00
pancake
320f322da3
Fix #18256 - Double free in RBin.DEX.libs (#18286) 2021-01-25 12:39:48 +01:00
Qijia Liu
b8afdf8d7d Fix memleak in db/formats/mangling/mangling 2021-01-25 02:37:21 +01:00
Paul I
59ad3b3c0b COFF: handle empty sections (#447) ##bin 2021-01-25 00:34:58 +01:00
Anton Kochkov
87d5855d35 Prevent NULL pointer dereference 2021-01-25 00:34:58 +01:00
Briand Djoko
f57677b554 Add additional ELF header fields to rz-bin output (#372) 2021-01-25 00:34:58 +01:00
pancake
1d9a6d3338
Fix #18274 - Fix crash in r2 *.wasm ##bin (#18275) 2021-01-24 19:44:32 +01:00
pancake
ce4e941043
Fix HUGE bottleneck in the WebAssembly pseudo disassembler and analyzer ##disasm (#18269) 2021-01-24 18:30:36 +01:00
pancake
2d2cef076c
Dont demangle with libs unless requested ##bin (#18268) 2021-01-22 15:53:24 +01:00
pancake
5dedf4aa63
Fix crash when wasm file contains symbols with large names ##bin (#18261) 2021-01-22 12:07:35 +01:00
Francesco Tamagni
d8b6f52e1d
Fix Mach-O rebase on fat slices ##bin (#18248)
* Don’t add boffset to macho sections paddr
* Add test
2021-01-20 08:08:43 +01:00
Liumeo
b8784098f7
Fix memleak in db/esil/apple (#18238) ##bin
* Add r_skiplist_insert_autofree and fix memleaks in db/esil/apple
2021-01-19 11:49:42 +01:00
pancake
0dbc4ee537 Add missing files and remaining patches from import 2021-01-19 05:37:17 +01:00
Alexis Ehret
a3f05a9b1a Fix dead increments in places 2021-01-19 05:37:17 +01:00
Francesco Tamagni
fb45d1de30 Fix crash in XNU kernel parsing (no cache) ##bin
Also handle corresponding chained pointers format
and rename made up name.
2021-01-19 01:29:31 +01:00
pancake
9b862a8ad8 One more -Werror=maybe-uninitialized issue fixed 2021-01-18 15:49:27 +01:00
pancake
08d7fe688c Implement RTable:sql and add RTable.name ##core 2021-01-15 10:56:58 +01:00
Liumeo
30afe39c5c
Fix aof and tcc db/formats/mach0/mach0
* Fix aof

* Fix tcc db/formats/mach0/mach0
2021-01-13 00:18:01 -05:00
pancake
5910d1891f Fix a couple of warnings for -Werror 2021-01-13 01:35:54 +01:00
pancake
298888dfec Fix issues spotted with gcc -Werror 2021-01-13 01:28:10 +01:00
pancake
449a313889
Fix PE Delay Imports for multiple delayed DLLs (rizin) ##bin (#18208)
Co-authored-by: Florian Maerkl <info@florianmaerkl.de>
2021-01-12 15:17:26 +01:00
pancake
1184610971
Fix the CI badge and fully rewrite all the workflows to make sense ##build
* Windows, Linux, Static, macOS, Android, iOS builds published for every commit
* Kept coverage, coverity, fuzzing tests, lgtm and -Werror jobs
* Kill the continuos, the over-engineered matrix and other empty or unnecessary tasks (250 vs 900LOC)
* Jobs TODO: fatmac, termux and rpm (centos) packages
2021-01-12 13:41:21 +01:00
Alexander von Gluck IV
93674e8f4c libr/pe: Add basic RISC-V architecture knowledge 2021-01-10 13:13:54 +01:00
pancake
cd58b50dd4 Fix warning 2021-01-09 19:38:41 +01:00
pancake
2f2526361c Initial implementation of the DEX annotation parser ##bin 2021-01-09 17:38:54 +01:00
pancake
791794678f Lowercase DEX method attributes and move r_num_bit_count() ##bin 2021-01-09 17:38:54 +01:00
pancake
3ab33d119e Code cleanup and other minor refactoring changes 2021-01-09 17:38:54 +01:00
pancake
44815d3792 More assert issues fixed from the fuzzsuite 2021-01-05 02:17:37 +01:00
pancake
a25e3c1409 Fix some null asserts in PE and ELF parsers 2021-01-05 02:17:37 +01:00
eagleoflqj
2879c582af Use pj in cmd_info.c ##refactor 2021-01-03 01:24:58 +01:00
pancake
b69355bb84
Fix #18136 - Remove RBin.is_debugger and use cfg.debug (#18146) ##refactor 2021-01-01 22:48:02 +01:00
eagleoflqj
d306734aef correct json & clean newline 2021-01-01 22:04:37 +01:00
Eduard MURESAN
06417eaf30 Fix pdb information dumped as json 2021-01-01 22:04:37 +01:00
Liumeo
7a222e68dc
Fix some arm32 warnings (#18104) 2020-12-26 16:18:49 +01:00
ivan tkachenko
38f5804ecf Move breaks inside switch-case scopes
Update DEVELOPERS.md code style section and
refactor switch-cases across all code base.
2020-12-26 11:15:03 +01:00
ivan tkachenko
d5f651a59e Trailing whitespaces are getting in the way 2020-12-26 11:15:03 +01:00
pancake
b4b48cbf86 Fix UAB when freeing a non allocated item in the xnu.kernelcache RBin plugin 2020-12-24 10:44:28 +01:00
Liumeo
55ce4ce303
Use pj in pdb_downloader ##refactor (#18084) 2020-12-21 23:46:12 +01:00
Lazula
f2976d3c7e
Use r_str_get_fail() throughout codebase ##refactor (#18079) 2020-12-21 08:51:44 +01:00
Liumeo
a0b6fed4ca
Fix iAj and use pj in bin.c ##refactor (#18076) 2020-12-21 01:14:37 +01:00
pancake
d3157e2ed3
Fix 32 critical COVs (UAF, UB and OOB) (#18077) 2020-12-21 01:10:22 +01:00
Liumeo
64e36a85af
Fix arm32 db/formats/dmp/dmp (#18062) 2020-12-19 10:00:09 +01:00
Liumeo
1491be12b6
Fix arm32 db/cmd/cmd_i (#18056) 2020-12-19 09:59:30 +01:00
Liumeo
56cdc7c112
fix arm32 db/cmd/cmd_open (#18052) 2020-12-18 00:38:31 +01:00
pancake
aaa930ab26
Improve and formalize r_name_check() along all the base ##core (#18020) 2020-12-16 14:49:50 +01:00
pancake
693e777638
Handle RELATIVE (todo) and IRELATIVE relocs for relative relocs in ELF for ARM64 ##bin (#17614) 2020-12-13 19:20:29 +01:00
Lowly Worm
ce1d9b614d
initialize variable that could result in wild free (#18024)
tmp must be initialized to null
in the case a function isn't parsed properly, tmp doesn't get touched in parse_function, so then a wild pointer is free'd
2020-12-13 09:54:47 +01:00
Lazula
243bc871c3 Multiple refactors in io and util ##io ##util ##refactor
* Add r_io_map macros throughout code base
* Update string NULL-checking with renamed functions r_str_get() and r_str_getf()
* Change string NULL-checks throughout code base to use functions
* Add r_str_get_fail() to specify a custom string to return if NULL-check fails
* Mark JSON to be updated with PJ with "TODO PJ"
* Incidental style updates such as missing spaces
2020-12-13 05:09:13 +01:00
GustavoLCR
1abd72f8af
PDB: Fix NULL deref with unsupported leaf type (#17996) ##bin 2020-12-06 18:12:29 +01:00
GustavoLCR
32cb22b9a6
Fixes for MSVC demangling (#17994)
* MSVC demangling: Add a space between cc and func ptr
* MSVC demangling: Fix extremely long types demangling
* MSVC demangling: Fix member function pointer demangling
* Add test
2020-12-04 15:20:46 +08:00
GustavoLCR
6c37b12d63
Fix #17979 - Fix ASAN timeout for PE (#17993)
r_buf_read() is extremely slow
2020-12-04 15:20:09 +08:00
pancake
b2f210a0cc
Fix asserts in r2 -a snes foo.sfc ##bin (#17990)
Co-authored-by: pancake <pancake@nopcode.org>
2020-12-04 12:16:09 +08:00
eagleoflqj
facdda17e3 cp-demangle - fix tcc build ##build 2020-11-27 12:36:59 +08:00
GustavoLCR
ee46646df8
Set realname for PDB flags (#17967) 2020-11-27 12:22:58 +08:00
Liumeo
63249d6a84
Fix s390x mdmp symbols count ##refactor (#17977) 2020-11-27 12:22:03 +08:00
Liumeo
536e420f58
Fix s390x Warning: File is not PE (#17938)
* fix s390x Warning: File is not PE

* use r_buf_read

* Fix a typo

Co-authored-by: Anton Kochkov <xvilka@gmail.com>
2020-11-23 18:24:19 +01:00
Paul I
3ae296254b
Fix memleak in fcn_recurse(), r_bin_info_free(), r_core_anal_cc_init(), update_asmbits_options() (#17876) 2020-11-19 15:55:31 +08:00
Liumeo
da50d751b7
Fix System Z ELF asm.arch & bits (#17936) 2020-11-19 11:43:14 +08:00
Anton Kochkov
6b6ec5dc17 Fix fuzzing crash in LE 2020-11-17 13:04:57 +08:00
Anton Kochkov
5da1b3b076 Fix some warnings 2020-11-16 18:56:21 +08:00
Anton Kochkov
14f82ee301 Fix formatting warnings for sdb_fmt() ##refactor 2020-11-12 15:14:42 +08:00
Anton Kochkov
aaccc09828 Variadic argument fixes 2020-11-10 11:11:45 +08:00
Khairul Azhar Kasmiran
91aebb6490 Add r_bin_coff_obj::scn_va guards 2020-11-04 10:10:13 +08:00
Paul I
fab33cd939
Fix #17878 (COFF fuzz segfault) (#17881) 2020-11-02 18:44:32 +08:00
Liumeo
3aca0298a8
Fix macos warning: overrides prior initialization (#17882) 2020-11-01 01:13:52 +01:00
Paul I
92501b0082
COFF: add ARMNT and ARM64 support ##bin (#17800) 2020-10-29 13:33:43 +08:00
pancake
e9916a1914
Fix warnings in RBin.{dmp,elf} (#17865) 2020-10-28 10:21:07 +01:00
Liumeo
b0ee85edbf
Remove unnecessary macro ##refactor (#17821) 2020-10-28 11:24:47 +08:00
x1nixmzeng
a25af4d367
Fix XBE format symbol name lookup ##bin (#17841) 2020-10-26 13:55:39 +08:00
pancake
3fffa6f7e1
Fix #17804 - This has-main code in swift-sd.c is already in libdemangle (#17812)
Co-authored-by: pancake <pancake@nopcode.org>
2020-10-22 16:26:32 +08:00
Anton Kochkov
21907a565e Fix format string warnings 2020-10-19 11:50:06 +02:00
GustavoLCR
79de725396
Fixes for MSVC demangling (#17783)
* Support demangling nested names
* Support demangling RTTI operator codes
* Fix parsing function pointers with access modifier
2020-10-16 12:52:01 +08:00
Riccardo Schirone
1e58692071
Fix incorrect uses of printf-like functions ##refactor (#17648) 2020-10-13 16:26:15 +02:00
Riccardo Schirone
741d22ed61
Use -Werror when building in CI (#17781) 2020-10-13 12:42:57 +02:00
pancake
34285a1ed4
Set v850 disassembler when opening v800 ELF files ##bin (#17778) 2020-10-13 02:30:11 +02:00
pancake
c521a6290c
Move spc700 asm,bin plugins to radare2-extras ##asm (#17762)
Co-authored-by: pancake <pancake@nopcode.org>
2020-10-10 12:11:29 +08:00
GustavoLCR
02edb130d7 Fixes for MSVC name demangling
* Fix back-reference to templated operator functions
* Fix back-reference to templated names
* Support demangling rvalue references
* Support demangling 'std::nullptr_t' type
* Support demangling function types inside templates
* Support demangling array types inside templates
* Support demangling empty templates
* Support demangling compiler generated statics
* Support demangling thunk functions
2020-10-06 10:54:29 +08:00
phakeobj
1aba692eb6
Treat error as a format string instead of a string literal (#17731) 2020-09-29 12:36:59 +08:00
pancake
aa7de006e6 Fix TinyCC build ##build 2020-09-27 13:33:26 +08:00
phakeobj
89e1618e3c
Fix #17353 - Remove duplicated implementation of uleb128 in mach0 ##bin (#17489) 2020-09-24 09:47:23 +02:00
Alexis Ehret
ec6a52e8a9
Fix 3 lgtm warnings (#17465) 2020-09-24 09:37:41 +02:00
GustavoLCR
22468fdc0a
Support demangling MSVC managed pointer types ##bin (#17694)
* Demangle __clrcall calling convention
* Transform a giant macro to a function for sanity sake
* Add tests
2020-09-23 16:40:10 +02:00
junchao-loongson
ca9b6ac1a0
Set asm.cpu for mips.gnu derived from the ISA defined in the ELF ##bin (#17555) 2020-09-21 16:58:07 +02:00
pancake
3e5677bd7c Refactor and prefix with R_BIN_ELF_ defines in .h ##bin 2020-09-17 12:38:25 +02:00
pancake
ba9960cffd Dynamic ELF libs can also have relocs ##bin
* Make 32 and 64 bit reloc writes more generic
2020-09-17 12:38:25 +02:00
pancake
63031cc3e9 Add basic support for arm and arm64 ELF relocs ##bin 2020-09-17 12:38:25 +02:00
pancake
b261f2ed5d Define as words more sections in ELF ##bin 2020-09-17 12:38:25 +02:00
Khairul Azhar Kasmiran
d9057505dc
Set RPATH/RUNPATH on r2 libs too if local (#17639) 2020-09-15 09:16:14 +02:00
GustavoLCR
5c96166e2b
Fix MSVC template demangling with ref to mangled symbol (#17601) ##bin
* Fix not adding the template name as an abbreviation
* Add test
2020-09-13 22:38:51 +02:00
Francesco Tamagni
67e79f0bb3 Fix ObjC ivar parsing ##bin 2020-09-13 22:36:38 +02:00
Francesco Tamagni
3c4fc3fc26 Support ObjC small method lists ##bin 2020-09-13 22:36:38 +02:00
Francesco Tamagni
90f4ba69b5 Support iOS 14.x dyld shared cache ##bin 2020-09-13 22:36:38 +02:00
Francesco Tamagni
e74b004239 Add support for new macOS kernelcache ##bin 2020-09-13 22:36:38 +02:00
Aswin C
871857df1a
Use PJ in iAj ##json (#17636) 2020-09-13 09:58:17 +02:00
Riccardo Schirone
ec21daa6c2
Fix crash when running iA while head_flag is not defined (#17630) 2020-09-11 11:41:09 +02:00
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 080bf4918c (#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
Michael Scherer
db5cce396d
Fix C99 construct without -c99 (#17077)
* Fix C99 construct without -c99

Co-authored-by: Anton Kochkov <xvilka@gmail.com>
2020-06-18 14:33:26 +08:00
pancake
661cc70f4a Fix memory leak by moving the check some lines above
Cleanup and simplify section loop in macho parser
2020-06-17 11:44:38 +08:00
pancake
eba178b820 Fix null deref when loading machos without segments ##bin
testfile: clusterfuzz-testcase-minimized-ia_fuzz-5671063689363456.uu
2020-06-17 11:44:38 +08:00
pancake
97f51159e1 Fix DoS on corrupted macho executable ##bin
Fix clusterfuzz-testcase-minimized-ia_fuzz-5704628234092544.uu
2020-06-17 11:44:38 +08:00
pancake
00b76ab433 Fix null deref in quit when loading corrupted machos ##bin 2020-06-17 11:44:38 +08:00
pancake
c1328f7e10
Fix memory leaks in RBin reported by Coverity (#17068)
* Fix memory leaks in RBin reported by Coverity

Co-authored-by: pancake <pancake@nopcode.org>
2020-06-16 17:30:04 +08:00
Jerome-PS
aeca50166d
Adding support for BA2 ELF binaries ##bin (#17063)
* Adding support for BA2 CPU

* Code clean up

* Moving support for BA2 CPU to radare2-extras

Co-authored-by: Jerome-PS <Jerome-PS>
2020-06-16 10:10:01 +02:00
phakeobj
8e8250e586
Support arbitrary length identifiers in Mach-O ##bin (#17064)
* Convert symbol_t name member from char[R_BIN_MACH0_STRING_LENGTH] to char *

* Invert the variables that assmebles the ht key to ensure uniqueness

Long identiers will fill the key buffer with the first 256 chars of the
name and have the rest of the name and the addresss ignored. This can
lead to two different identifiers having the same key.

The first 256 characters of two different identifiers might be
identical, while their address won't. Therefore, to ensure different
identifiers will have different keys, we sholud first emmbed the part
that is ought to be unique in the identifier, the address, and only then
take the identifier itself into account.

* Add testcase

* Define variable outside of the for-loop block

* Remove redundant conditional free

* Replace sdb_fmt with r_str_newf

* Add missing format string argument and use r_str_newf

* Use NULL instead of 0 for name pointer

* Change last to bool and adjust rvalue accordingly

* Ensure we do not process empty an empty string

Co-authored-by: phakeobj <phakeobj@users.noreply.github.com>
2020-06-15 20:39:59 +08:00
pancake
bd9a604a87
Check for return values in about ~50 method calls (#17025) 2020-06-15 11:24:43 +02:00