24257 Commits

Author SHA1 Message Date
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
Khairul Azhar Kasmiran
d236343411
Fix runaway scrolling in Visual mode after mashing down movement key on Windows Terminal (#17006) ##visual
* Fix runaway scrolling in Visual mode after mashing down movement key on Windows Terminal
* Reindent
* Use is_mintty() instead
* Use flush_stdin() instead
* Add a comment
2020-06-05 19:54:11 +08:00
karliss
a874bec70f
Fix leaks detected by coverity. (#17008) 2020-06-05 10:17:06 +02:00
Sylvain Pelissier
15b181e401
Add ESIL flag update for adds and subs instructions (#17005) 2020-06-04 20:36:56 +02:00
zawwwu
9de7c2e8dd
x86 pseudo for LEA is wrong (#16980)
* Better solution + tests

* Adding pseudo for movabs
2020-06-04 13:02:45 +02:00
Riccardo Schirone
58e5aa0887
Enable unit tests compilation by default in meson (#16990)
Including Fixes for Windows
2020-06-04 12:14:15 +02:00
Sylvain Pelissier
3e4862dc93
Fix ESIL conditional branch and lui for RISC-V (#16996) 2020-06-04 11:49:34 +02:00
DharmaCode
e3a289d454
rabin2 could not detect go in macho binaries (#16993)
* rabin2 could not detect go in non-elf binaries

* better comparison for go detection

* updates based on suggestions by ret2libc. re-tested accordingly after updates

* updates based on suggestions by ret2libc. re-tested accordingly after updates

Co-authored-by: Alex Useche <alex.useche@nvisium.com>
2020-06-03 17:55:26 +02:00
Riccardo Schirone
a14f5c0777
Update tree-sitter to 0.16.8 (#16991)
* Fix CentOS6 CI by specifying PKG_CONFIG_PATH
* Do not define var inside for-loop
2020-06-03 15:01:47 +02:00
Khairul Azhar Kasmiran
1fef151d37
r_cons: Save and restore the active code page on Windows (#16998)
* r_cons: Save and restore the active code page on Windows
* Use r_sys_cmdf() instead
2020-06-03 18:54:55 +08:00
GustavoLCR
9f40bfae6d
Fix prompt bug on Windows (#16981)
Fixes line wrapping causing prompt to descend every keypress
2020-06-03 12:48:07 +08:00
Ole André Vadla Ravnås
ee9025c917
Fix crash and warnings when opening an iOS/arm64e DSC (#16959)
* Improve handling of Mach-O bind opcodes

- Reset state between regular binds, lazy binds, and weak binds.
- Stop parsing when encountering the DONE opcode, except for when
  processing lazy binds.
- Rework handling of THREADED opcode to match Apple's behavior, where
  the segment index isn't used. Also fix the page_count calculation.
- Eliminate redundant boundary checks to improve clarity.

* Fix symbol comment logic for zero-sized symbols
2020-06-02 16:09:14 +08:00
GustavoLCR
19ce38d876
Fix type matching with loaded PDB ##anal (#16983)
* Use r_flag_get_by_spaces() instead of manually comparing the flagspace name
2020-06-02 10:33:23 +08:00
Khairul Azhar Kasmiran
f3c227ee88
elf64 pf.elf_header: w -> N2 for phnum, shnum, shstrndx, ehsize, phentsize and shentsize (#16992)
* elf64 pf.elf_header: w -> N2 for phnum, shnum, shstrndx, ehsize, phentsize and shentsize
* Add support for 'N' to pfc
2020-06-02 10:27:58 +08:00
Fangrui Song
5817770e29
Fix RISC-V ESIL for jal and jalr (#16984) 2020-06-01 17:04:42 +02:00
Riccardo Schirone
9b6160cf5f
Fix ; at the end of the value of eq_sep_args (#16988) 2020-06-01 11:07:13 +02:00
Khairul Azhar Kasmiran
fc4ea0f9a6
elf32 pf.elf_header: w -> N2 for phnum, shnum, shstrndx, ehsize, phentsize and shentsize (#16978)
* elf32 pf.elf_header: w -> N2 for phnum, shnum and shstrndx
* elf32 pf.elf_header: w -> N2 for ehsize, phentsize and shentsize
2020-06-01 12:33:42 +08:00
Vane11ope
3d4dd3a04c
Fix a glitch of W + j in panels (#16971) 2020-06-01 12:30:35 +08:00
Khairul Azhar Kasmiran
1cb18df8b4
ahi 10 does signed decimal with 32-bit gp regs + ahi 10u for unsigned decimal (#16970)
* ahi 10 does signed decimal with x86 32-bit regs + ahi 10u for unsigned decimal
* Use arch-independent r_reg api instead
2020-05-30 01:31:22 +08:00
karliss
18649ad666
Do the prefix check after prefix argument has been processed. (#16950) 2020-05-29 11:04:15 +08:00
Sylvain Pelissier
8b04b3818f
Correct RISC-V ESIL for jumps (#16962) 2020-05-29 11:03:41 +08:00
Riccardo Schirone
7985537330
Fix pfo command without arguments (#16961)
* Fix pfo command without arguments
* Fix radare2-ci-tree-sitter tests
2020-05-28 16:29:44 +03:00
Dennis Goodlett
cf92255b6d
replace repeated code in sign.c with new function (#16951)
* replace repeated code in sign.c with new function

The functions r_sign_diff and r_sign_diff_by_name had repeated code to create
a list of deserialized signatures from a sign space. This commit moves that
code into a helper function.

* Update libr/anal/sign.c

* Update libr/anal/sign.c

Co-authored-by: Dennis Goodlett <dennis@hurricanelabs.com>
2020-05-28 09:54:29 +02:00
Maxim Ivanov
59c9767adc
Fix half-assed comparators (#16953)
The expression (x > y) returns 1 or 0.
strcmp(..) returns 1, 0 or -1... and is valid RItemComparator.

I.e. one can't give a boolean answer where {1,0,-1} is expected.

This bug impacts the order of enumeration of locals and args in
functions. Starts occuring from mid-sized and bigger funcs
(~50 locals, then the sorting algo switches to mergesort); leads
to unstable and incorrectly-sorted vars dumps in the project file.

A motivating unit test is added as well.

A little algebra trick keeps it simple and efficient:
using no branching, with two antisymmetric bool→int conversions
we achieve the required {-1,0,1} codomain.

TL;DR: if you write a comparator function (to sort with),
make sure it returns 3 distinct values, not just 1 & 0.
2020-05-28 11:18:06 +08:00
Khairul Azhar Kasmiran
f255a82a1b
Fix ahi help msgs (#16955)
* Fix ahi help msgs
* Use angle brackets in ahi usage msg as well
2020-05-27 22:26:22 +08:00
Zi Fan
e968c9442a
Fix out-of-bounds write in arch_parse_reg_profile (#16956) 2020-05-27 14:39:17 +02:00
Giovanni
d2e6b41e53
Fix pre c99 loop issue and useless negative check (#16957)
Co-authored-by: Giovanni Dante Grazioli <giovanni.dantegrazioli@nbs-system.com>
2020-05-27 12:44:21 +02:00
NIRMAL MANOJ C
305cc00766
Migrating RAnnotatedCode to radare2 (#16939)
* Added comments for functions in RAnnotatedCode
* Modified code to follow coding style
* Added more documentation and changed the name of core_annotated_code.c
* Fixed memory leaks
2020-05-27 11:54:31 +08:00
karliss
688c411afe
Limit PR build timeout. (#16952)
Typical runs take 5-15 minutes. Default 6h timeout is too much.
2020-05-27 11:51:54 +08:00
Paul I
91255a4ccc
Fix ret op type for RISC-V (#16954) 2020-05-27 11:51:01 +08:00
Zi Fan
3bea2cf5ed
Fix incorrect offset and type when parsing target description via remote gdb (#16948)
* Change regsize and regoff to mean bitsize instead of byte size
* Account for both "group" and "type" fields when extracting regs
2020-05-26 22:53:36 +08:00
Khairul Azhar Kasmiran
c9eceab2d6
Fix prc handling of single-char flags (#16942)
* Base test output

* Fix prc handling of single-char flags

* Remove unneeded name and *name checks
2020-05-25 23:05:37 +08:00