24288 Commits

Author SHA1 Message Date
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
Riccardo Schirone
aeddbc85aa
Use stale label instead of wontfix (#17085) 2020-06-16 15:48:33 +08:00
Riccardo Schirone
66ac059336
First version of stale file to automatically close old issues (#16924) 2020-06-16 12:18:23 +08:00
Khairul Azhar Kasmiran
ca49982a63
r2r: Support char diffing (#17066) 2020-06-15 18:55:03 +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
Cyrill Leutwiler
17aa65d324
Fix corrupt JSON output in types ##signatures (#17065) 2020-06-15 19:57:09 +08:00
pancake
bd9a604a87
Check for return values in about ~50 method calls (#17025) 2020-06-15 11:24:43 +02:00
pancake
cea53c7112
Fix ~300 warnings in the pyc disasembler (#17071)
Co-authored-by: pancake <pancake@nopcode.org>
2020-06-15 17:16:04 +08:00
pancake
6e7c6a63b9
Fix crash in PE when resolving corrupted ordinal exports ##bin (#17069) 2020-06-15 11:13:51 +02:00
gkpln3
b19078d83a
Fixed hang when analysing objc binaries ##bin (#17021)
* Fixed an issue when analyzing Objective C methods, `count` can be 0xffffffff in some places, which in turn can lead to integer overflow, causing radare2 to try and analyze the whole memory space, effectively causing it to hang.

Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
Co-authored-by: pancake <pancake@nowsecure.com>
2020-06-15 14:29:59 +08:00
GustavoLCR
56b9356f91
Fix NULL deref and heap-buffer-overflow (#17052) 2020-06-15 13:04:56 +08:00
HoundThe
1650ee69dc
DWARF 4 and 5 line parsing additions ##bin (#17061)
* Moved dwarf prototypes to its header, added information for DWARF4
* Fixed incorrect line parsing for last compilation unit
* Added ability to parse DWARF4 and DWARF5 but without parsing out the source files
2020-06-15 12:39:48 +08:00
Vane11ope
26eb7daed0
Fix a minor glitch (#17057)
* Fix a minor glitch

* Code cleanup

* clean up and stop depending on fpu
2020-06-15 06:02:41 +09:00
Aswin
b24f4f02d0
Update arm.sdb.txt: Added instruction descriptions for ARM (#17070) 2020-06-14 21:11:40 +02:00
pancake
160fc95e66
Use (void) instead of () in function signatures (#17026) ##refactoring
* Use (void) instead of () in function signatures
* Add test to avoid further contributions to commit the same mistake
2020-06-14 16:08:32 +02:00
pancake
84ecf9fff2
Fix all the coverities detected last month (#17060)
* Fix all the coverities detected last month

* Fix one more cov

* Fix build

* refix build

Co-authored-by: pancake <pancake@nopcode.org>
2020-06-14 13:21:57 +02:00
Khairul Azhar Kasmiran
ddeb513374
r2r: Don't trim diff lines (#17059) 2020-06-14 13:06:58 +08:00
GustavoLCR
77cc18ba04
Fix R2_INCDIR on Windows (#16940) 2020-06-12 17:12:48 +08:00
Riccardo Schirone
70e3d3bc56
Fix compiler warnings (#17046) 2020-06-12 10:26:55 +02:00
GustavoLCR
3f54430244
Fix takeover of initial block of function ##anal (#17051) 2020-06-12 10:25:42 +02:00
GustavoLCR
ae2ed249f8
Fix crash in r_anal_block_chop_noreturn (#17012) 2020-06-12 10:19:50 +02:00
pancake
6a37a4ecef
Add missing reloc definitions for C-SKY, RISCV and AARCH64 ##bin (#17032)
* Add missing reloc definitions for C-SKY, RISCV and AARCH64 ##bin
* Update glibc_elf.h from GNU's GIT
* Fix build EM_HEXAGON is now EM_QDSP6
* Dont include features.h because its a gnuism

Co-authored-by: pancake <pancake@nopcode.org>
2020-06-12 15:26:30 +08:00
Vane11ope
3c5888fe70
Fix a minor glitch (#17050) 2020-06-12 15:35:27 +09:00
Riccardo Schirone
347374c494
Check node_string length before subtracting 2 from strlen (#17044) 2020-06-12 12:24:01 +08:00
Dennis Goodlett
83418323e0
Bestmatch ##signatures (#16977)
* implment basic concept signature bestmatch
* bestmatch works without zignspace
* zb shows top n closet matches
* add tests for zb command
* return list from r_sign_find_closest_sig

Co-authored-by: Dennis Goodlett <dennis@hurricanelabs.com>
Co-authored-by: pancake <pancake@nowsecure.com>
2020-06-12 10:58:27 +08:00
Florian Märkl
f5c25c6bf1
Fix a fatmach0 test under aarch64 ##test (#17048)
Use ARGS instead of oa
2020-06-12 10:54:03 +08:00
HoundThe
f298057646
Fix signedness issue in the DWARF line parser on ARM64 (#17031) 2020-06-12 10:50:48 +08:00
Anton Kochkov
ffe743ef39
Fix #4056 - rename DEPS to R2DEPS ##build (#17020)
* Rename DEPS to R2DEPS
* Cleanup of sys/build.sh
2020-06-12 10:49:28 +08:00
Riccardo Schirone
fab89a61d9
Replace radare with trufae (#17045) 2020-06-11 07:40:46 -05:00
pancake
75ee57bfb0
Update SDB with boolified SdbForeachCallback (#17040) 2020-06-11 11:25:23 +02:00
Alexis Ehret
fa7b8ea87b
Move DT_NEEDED in RBinElfDynamicInfo and remove dyn_buf (#17009) ##elf 2020-06-11 10:50:54 +02:00
Khairul Azhar Kasmiran
fcedd4d21e
r2r: Remove diff header and colorize @@ line (#17041) 2020-06-11 13:03:48 +08:00
Francesco Tamagni
0cd965d1f1
Fix parsing of objc class data pointer ##bin (#17037)
Flags are encoded in the lower / upper bits of
the pointer to Objective C class data. This strips those
bits from the pointer before using it.
2020-06-11 12:33:38 +08:00
pancake
b045d2553b
Use strrchr when 2nd argument of r_str_rchr is NULL (#17042) 2020-06-10 22:34:05 +02:00
pancake
3e06075c03
Add endbr64 as a function prelude for x86-64 binaries ##anal (#17030)
* Add endbr64 as a function prelude for x86-64 binaries ##anal
* Add test for endbr64 with aap
* Add endbr32 for aap
2020-06-10 18:55:31 +02:00
GustavoLCR
04edfa82c1
Fix command injection on PDB download (#16966)
* Fix r_sys_mkdirp with absolute path on Windows
* Fix build with --with-openssl
* Use RBuffer in r_socket_http_answer()
* r_socket_http_answer: Fix read for big responses
* Implement r_str_escape_sh()
* Cleanup r_socket_connect() on Windows
* Fix socket being created without a protocol
* Fix socket connect with SSL ##socket
* Use select() in r_socket_ready()
* Fix read failing if received only protocol answer
* Fix double-free
* r_socket_http_get: Fail if req. SSL with no support
* Follow redirects in r_socket_http_answer()
* Fix r_socket_http_get result length with R2_CURL=1
* Also follow redirects
* Avoid using curl for downloading PDBs
* Use r_socket_http_get() on UNIXs
* Use WinINet API on Windows for r_socket_http_get()
* Fix command injection
* Fix r_sys_cmd_str_full output for binary data
* Validate GUID on PDB download
* Pass depth to socket_http_get_recursive()
* Remove 'r_' and '__' from static function names
* Fix is_valid_guid
* Fix for comments
2020-06-10 18:00:00 +02:00
pancake
26e23eecfb
Add missing switch-case in RAnal.wasm to fix a warning (#17038)
Co-authored-by: pancake <pancake@nopcode.org>
2020-06-10 15:23:28 +02:00
pancake
9978bbd7c5
Implement assembler endbr32 and endbr64 instructions for x86-32/64 (#17035) ##asm
Co-authored-by: pancake <pancake@nopcode.org>
2020-06-10 19:15:46 +08:00
condret
ae883f0cd3 Cleaning up again 2020-06-10 02:24:03 +02:00
condret
6fe90763f5 Some cleanup 2020-06-10 02:24:03 +02:00
condret
c5a2a6562e fix #16995, #16994 and some other stuff 2020-06-10 02:24:03 +02:00
pancake
7bdafe5638
Kill tinyrange api because it's not used anywhere (#17027) 2020-06-09 21:20:16 +02:00
Sergi Àlvarez i Capilla
1e1a263cab
Kill r_print_format_length because it is unused (#17022) 2020-06-09 20:19:46 +02:00
Khairul Azhar Kasmiran
54950e39fa
r2r: Use git diff on Windows (#17024) ##windows 2020-06-09 23:10:56 +08:00
Khairul Azhar Kasmiran
a934a39236
pfc: Support n# (#17011) ##print 2020-06-08 19:29:21 +08:00
Riccardo Schirone
97f2d9cf5c
Fix elf reloc crash (#17004)
* Fix wrong computation in get_next_not_analysed_offset

* Uses virtual address in read_reloc and use elf_v2p to convert it to
  the right offset in the file, instead of relying on base->baddr
  directly. Dynamic info contain virtual address, not offsets.
* get_next_not_analyzed_offset should return the offset starting from
  section_vaddr, to ensure the offset can never be decremented.

* use num_relocs to possibly limit the number of stored relocations

Using num_relocs works both as a defensive measure in case the initial
size computed by get_num_relocs_approx is wrong and as a way to limit
the number of relocation entries read by the parser, in case the
relocation section is so big that we can't allocate enough memory
(probably a fake section).

* Add support for AARCH64 reloc entries
2020-06-08 13:26:49 +02:00
Anton Kochkov
171873b9c3
Fix test for ARM64 builds (#17014) 2020-06-08 13:45:06 +08:00
HoundThe
80aca08721
Fix in a dwarf line information parsing implementation (#16976) 2020-06-07 11:26:31 +08:00
Alexis Ehret
77e9059fd3
Fix Missing Exports and Imports on ELF (#17001)
* Remove the offset check
* Add regression test for the invalid offset
2020-06-07 11:24:45 +08:00