69 Commits

Author SHA1 Message Date
Riccardo Schirone
2ffa790e0a
Generate help automatically ##newshell (#16782)
* Add additional RCmdStatuses
* ?? should be a cmd_identifier, not help_command
2020-06-17 21:29:23 +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
GustavoLCR
ae2ed249f8
Fix crash in r_anal_block_chop_noreturn (#17012) 2020-06-12 10:19:50 +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
7bdafe5638
Kill tinyrange api because it's not used anywhere (#17027) 2020-06-09 21:20:16 +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
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
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
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
GustavoLCR
146c788fa0
Improve BP vars/args detection ##anal (#16935)
* Take into account initial BP position in stackframe
* Add reg name to RAnalVarAccess
* Add `anal.vars.stackname` config variable
* Fix riscv op/src imm info filling
* Fix getting BP vars if it is set with LEA
* Fix arg detection for functions that call __chkstk
* Fix tests

Signed-off-by: GustavoLCR <gugulcr@gmail.com>
2020-05-25 12:55:31 +08:00
Florian Märkl
45be547b15
Fix r2r -i when fixing multiple tests (#16817) 2020-05-14 15:10:03 +02:00
FXTi
d62c365856
Refactor r_big for gmp and ssl ##util (#16804)
* Fix GMP implementation
* Complete OpenSSL impl and pass all test. It's ready
2020-05-14 02:45:10 +02:00
HoundThe
09ed9800d0
Initial API for base type kinds (enum, struct, union) (#16723) ##anal 2020-05-13 20:49:25 +02:00
Florian Märkl
69cf5d662d
Add pj_reset() API ##json (#16802) 2020-05-12 00:11:42 +02:00
Riccardo Schirone
56f88a0e20
Remove INNER nodes and merge inner node with the command with same name (#16784)
* Remove INNER nodes and merge inner node with the command with same name
* Add test
2020-05-11 10:55:49 +02:00
Florian Märkl
edf1be10d1
Refactor Meta out of SDB (#16716) 2020-05-09 20:49:28 +02:00
Florian Märkl
242f1efdfa Add RIntervalTreeIter typedef 2020-05-09 12:27:17 +02:00
Florian Märkl
63c09c7ed6 Add breaking to RIntervalIterCb 2020-05-09 12:27:17 +02:00
Riccardo Schirone
72f97959e8
Fix Tests after Reports by asan (#16776)
* Fix memory leak in IO
* Fix memory leak in cmd_api
* Remove unused variables in test_table
* Fix memory leak in test_flags
* Fix memory leak in test_list
* Fix memory leaks in test_anal_var
2020-05-08 21:45:01 +02:00
Riccardo Schirone
03a5c4d3f5
Remove RCoreCmdStatus and just use RCmdStatus (#16774)
* Remove RCoreCmdStatus and just use RCmdStatus
* Assume RCorePlugins returns true/false
2020-05-06 14:38:20 +02:00
Riccardo Schirone
64e6df5004
Extend RCmdDesc with different types (#16738)
* Add RCmdDesc and use it for newshell to call command handlers
* Keep supporting existing RCorePlugin commands
* Properly free RCmdDesc tree
* Remove help from API because not used
* Check for cp->call before using it
* Set res to 0 because otherwise it could exit too early
2020-05-06 14:34:19 +08:00
Francesco Tamagni
e9152db544 Add unit test for r_leb128 2020-05-05 18:47:23 +02:00
Riccardo Schirone
79bee09fc3 Use g->x and g->y to rebase x/y got with r_str_str_xy
* Use RVector instead of RPVector
* Use RAGraph instead of the fixed core->agraph which may be wrong
* Fix infinite loop and remove unused functions
2020-05-03 17:33:36 +02:00
pancake
af4b6e7dc3
Avoid the use of for (int in our codebase (#16718) 2020-04-27 15:47:21 +02:00
pancake
80a01cb4e3
Implement r_strbuf_setptr API and improve + test it more ##util (#16649)
Co-authored-by: Florian Märkl <info@florianmaerkl.de>
2020-04-27 13:10:57 +02:00
Riccardo Schirone
169531abb5
Pass parsed arguments directly to RCmd (#16703)
* Remove r_cmd_call_long API because never used
* Remove r_cmd_add_long because never used
* Remove r_cmd_args and fix some spaces
* Add RCmdParsedArgs and unit tests
* Introduce r_cmd_call_parsed_args and use it in cmd.c
* Introduce RCmdParsedArgs in cmd.c
2020-04-24 09:46:43 +02:00
pancake
dcbb114a9d
Add missing r_vector_fini implementation ##util (#16650) 2020-04-21 17:02:45 +02:00
Florian Märkl
4560120be2
Refactor Variable Accesses out of SDB (#16632)
Fix #15944
2020-04-19 17:56:27 +02:00
Florian Märkl
efc067bc8b
Remove r_pvector_upper_bound() and add r_vector_lower_bound() (#16629) 2020-04-18 17:35:42 +02:00
Florian Märkl
dcf0c7049f
Chop Basic Blocks instead of re-analyzing in noreturn propagation (#16612) 2020-04-17 19:51:47 +02:00
pancake
0baf99d81d
Add generic reference counting implementation ##util (#16604)
* Unit test for the r-ref api
2020-04-17 11:56:28 +08:00
Florian Märkl
028db9cd62
Minor Fixes for XRefs counting (#16546) ##anal 2020-04-12 16:42:19 +02:00
Alexis Ehret
60ee0daa91
Implement r_table_uniq as API and query (#16385) ##util 2020-04-08 20:34:05 +02:00
pancake
7be2b26ec5
Use r_str_trim_head_ro instead of hacky while loops (#16416)
$ git grep IS_WHITE | grep while
2020-04-05 15:50:19 +02:00
Florian Märkl
2e735dff07 Add Windows argv Formatting 2020-04-02 23:41:58 +02:00
Florian Märkl
79fcf4fbff
Initial Implementation of R2R in C (#16216) ##test 2020-03-24 20:18:16 +01:00
Riccardo Schirone
d861918379
Fix minunit.h to compute macro arguments just one time (#16260) 2020-03-19 20:13:21 +01:00
Florian Märkl
0eb98d24be
Fix all Warnings for GCC 9 (#16223) 2020-03-17 13:31:28 +01:00
Florian Märkl
0b5e78e923
Make size arg of r_file_slurp() size_t (#16221) 2020-03-15 23:34:38 +01:00
Khairulmizam Samsudin
bb389101da
Make r_reg_get_list() search harder (#16202) ##reg 2020-03-13 12:01:54 +01:00
Khairul Azhar Kasmiran
2c8d5982cd
Convert preinc/predec in 3rd part of for statement to postinc/postdec (#16187) 2020-03-12 18:40:46 +01:00
Khairulmizam Samsudin
89cda00652
Add test for x64 to verify fpu and xmm register size and offset (#16186) 2020-03-12 11:48:41 +08:00
Khairulmizam Samsudin
35346d5a4f
Add r_reg_get() and r_reg_get_pack() for xmm registers (#16171) 2020-03-10 12:16:59 +08:00
Florian Märkl
1d8bf0e843
Fix r_anal_switch_op_new() args (#16165) 2020-03-09 11:57:46 +08:00
radare
1be8f02906
Add test for r_reg_get_value() and r_reg_set_value() (#16136) ##test 2020-03-05 14:42:47 +01:00
radare
5e629a3260
Avoidify the strTrim() APIs + cleanup/refactor ##util (#16056) 2020-03-02 21:39:37 +01:00
Khairulmizam Samsudin
ae1ef3ffbe
Create RReg test unit (#16081)
* Add test for r_reg_set_name() and r_reg_get_name()
* Add test for r_reg_set_profile_string()
* Add test for r_reg_setv() and r_reg_getv()
2020-03-02 13:39:47 +08:00
Florian Märkl
204e038211
Fix r_cons_rgb_parse() harder (#16061)
Also fix init of some ret args in r_meta_print()
2020-02-27 20:13:34 +01:00
Anton Kochkov
9ae41ae69f
Revert "Avoidify the RUtil.strTrim() APIs, rename trimHeadTail() and add asserts in RConfig ##refactor" (#16055)
This reverts commit 38b61c7bcfe55a727b9c3cedbc0f3147018e7c6b.
2020-02-26 09:59:04 +08:00
radare
38b61c7bcf
Avoidify the RUtil.strTrim() APIs, rename trimHeadTail() and add asserts in RConfig ##refactor 2020-02-25 17:53:09 +01:00