Commit Graph

116 Commits

Author SHA1 Message Date
Sergi Àlvarez i Capilla
3c9bef2f29 Allow rahash2 -a to be passed multiple times ##tools 2022-03-25 22:14:18 +01:00
Sergi Àlvarez i Capilla
fdc1ba6d6d Rewrite r_list_uniq with a faster algorithm ##core
* Adds _inplace() variant to avoid creating a new list
* Speedups aafs, aflm, pd, aflt and aflj
2022-01-11 23:29:47 +01:00
Lazula
ad749a0b1a Fix static/R_API function definition formatting
* Remove spaces before parens
* Remove spaces after asterisks
2021-12-21 20:58:12 +01:00
condret
53d8f3c591 Add r_list_iter_get_prev (siol eternal) ##util 2021-06-07 22:44:03 +02:00
condret
ddb8114999 Fix bug in r_list_insert that breaks r_list_sort ##util 2021-06-03 22:26:48 +02:00
condret
56c23ca3e0 Implement r_list_iter_to_top #18793 (siol eternal), do some minor cleanup and fix bug in r_list_prepend that breaks r_list_sort ##util 2021-06-03 21:43:23 +02:00
pancake
1bf73baae7
Optimize r_list_sort() (#18713) 2021-05-19 23:48:40 +02:00
pancake
4905e3af91
Fix #18260 - Sort bbs before comparing them for diffing code ##diff (#18584)
Co-authored-by: pancake <pancake@nopcode.org>
2021-04-16 17:57:13 +02:00
pancake
3d2856bb81 Type and null check fixes for RConfig 2021-01-18 11:15:04 +01:00
Dennis Goodlett
d78ef5602e Fix underflow in r_list_pop 2021-01-09 12:37:23 +01:00
Anisse Astier
a4c76ff641
Bring merge sort and insertion sort cmp function semantics together (#17473) ##util
Merge sort uses cmp (a, b) < 0 for its first test branch, and insertion
sort cmp (a, b) > 0 ; which means the 0 boundary goes in one case in one
branch, and in the other sort function in the other branch.

It makes it possible to support compare function that return true/false
instead of -1/0/1; although this isn't an acceptable use of
RListComparator, this prevents future bugs from appearing, because this
works with insertion sort, but not merge sort.

The main advantage of this patch is that both sort functions should sort
equal elements the same way. This stability is important for zignatures
for example.
2020-09-09 15:45:34 +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
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
Khairulmizam Samsudin
45f3715e51
Add tests for RList (set, get, reverse, clone, append, prepend) and remove legacy ##test (#16037) 2020-02-24 03:44:41 +01:00
Jeong Jihoon
6928ae192d Fix r_list_set_n() to allow empty element (#15820) ##util 2020-01-16 23:23:08 +01:00
Florian Märkl
14215350af Refactor RAnal Basic Blocks and Functions (#15169) ##anal
Basic Blocks are now global instead of owned by a single function.
2020-01-15 15:23:34 +01:00
Khairul Kasmiran
e92b01798e Use free() instead of R_FREE() in r_list_delete()
Same reason as #15430.
2019-11-08 19:38:38 +08:00
Khairul Azhar Kasmiran
1a4fec593f Use free() instead of R_FREE() in r_list_free() (#15430) 2019-11-07 15:40:59 +01:00
GustavoLCR
42a233ab75 Zero list length after being joined (#15175)
* Zero list length after being joined
* Zero list length after purging it
2019-10-03 13:49:20 +08:00
radare
ff36c12ea2
Initial implementation of the RTable API with filter, sorting and query APIs ##util 2019-08-25 22:43:34 +02:00
dodococo
2da973ed24 Fix #14335 - Add sort, join and uniq ##core 2019-06-20 13:11:37 +02:00
radare
e31a91b84b
Fix crash in canvas, some leaks and random code cleanup (#13254) 2019-03-03 23:41:19 +01:00
radare
c98136300d
Fix #12667 - Fix heap overflow in RCons.grep ##cons 2019-01-07 16:08:54 +01:00
Riccardo Schirone
7677ef9246 Memleaks (fix #11389) (#11674)
* util/strbuf: r_return ification!
* r_core_anal_hasrefs returns malloced string, free it after use
* util/list: r_return ification
* anal/fcn: prevent memleaks of RListIter objects in fcn->fcn_locs
The fcn_locs list was not freed because we don't need to free functions
from fcn_locs but we free them in core->anal. However, the list->free
method was set, even if never used, so I removed it.
Moreover, we should free the fcn_locs list anyway (but not the elements
inside) because the RListIter elements have been allocated on the heap.
* egg: remove *uck message
* core/cbin: check returned list before using it
* core/cbin: check list before using it
* util/strbuf: fix r_return condition in strbuf_append
* libr/core: fix some possible NULL deref and avoid function ptr casts
* only fcn->fcn_locs doesn't need the free function, the others do
2018-10-01 09:33:30 -04:00
Neven Sajko
4a722e80d8 Add braces to if, else, for, while ... (#11504) 2018-09-13 10:17:26 +02:00
pancake
a61d80ff9f Fix last coverities and the use of r_str_cmp as list comparator
* Fix avra test and avoid long time loading trash data in avra
2018-08-11 20:59:28 +02:00
David Carlier
c5ec231946 Attempt to fix #10693 issue. 2018-07-17 17:41:51 +02:00
Khairul Kasmiran
c1e9a3cc3a Removed some spaces 2018-07-06 21:06:13 +08:00
pancake
1414625ae0 Fix use of r_list_uniq in disasm, needs more review 2018-02-12 16:00:14 -06:00
pancake
bc84cd06d0 Implement r_list_uniq and fix the multiple main issue 2018-02-12 14:53:35 -06:00
pancake
163070e5e1 Fix infinite loop and use-after-free in r_flag_unset_glob 2017-11-28 16:52:33 +01:00
pancake
1a04c2a24d Get ready for the 1.6 release 2017-07-10 01:32:50 +02:00
pancake
8f6de80193 Fix #7619 - Make dm consistent with dmm 2017-07-10 01:02:21 +02:00
pancake
0668d04488 Honor color theme in p=, add palette rainbow primitives in RCons 2017-05-18 00:01:16 +02:00
alvarofe
f4448ebfaf Fix r_list_merge_sort to avoid stack exhaustion 2017-03-27 00:52:09 +02:00
alvarofe
377ef73df8 Revert "Fix r_list_merge_sort to avoid stack exhaustion"
This reverts commit b6b1b3e18e.
2017-03-27 00:25:32 +02:00
alvarofe
b6b1b3e18e Fix r_list_merge_sort to avoid stack exhaustion 2017-03-26 23:24:53 +02:00
Álvaro Felipe Melchor
aef64dd886 Added depth parm to control stack exhaustion sorting 2017-02-07 20:45:15 +01:00
Alex Kornitzer
1a81071d9d A correct implementation of r_list_join
From what I can see this function has never functioned correctly. At
most it would sort of maybe join two lists. This should resolve this
problem.

Signed-off-by: Álvaro Felipe Melchor <alvaro.felipe91@gmail.com>
2016-11-16 20:15:45 +01:00
pancake
e31164a5fa Fix latest covs 2016-10-29 13:06:11 +02:00
pancake
8d37adc546 Fix all pending null-deref covs 2016-10-26 23:22:04 +02:00
pancake
8b8151d12e Fix latest covs 2016-10-26 11:25:50 +02:00
pancake
d45999d10e Implement column sorting in RCons.grep 2016-10-25 12:03:55 +02:00
Álvaro Felipe Melchor
a2befc8adc Enhance performance in r_anal_fcn_get_in() using tinyrange and sorted adds
* added sorted parameter in r_list
* use r_list_sort in r_range_sort
* some clean up
* added is_data into RBinSection
* use tinyrange by default to improve speed
2016-10-25 01:12:06 +02:00
radare
20ec177ba0 Initial implementation of flag zones 2016-10-06 02:40:26 +02:00
Álvaro Felipe Melchor
44155e609c select sorting algorithm based on list's length 2016-10-06 00:34:52 +02:00
Álvaro Felipe Melchor
5b95f046f8 s/r_list_merge_sort/r_list_sort 2016-10-06 00:00:52 +02:00
Álvaro Felipe Melchor
fd542c75bb changes into merge sort to reassemble behaviour with sort 2016-10-06 00:00:50 +02:00
Álvaro Felipe Melchor
f6b94d7b75 changed r_list_length to use list->length 2016-10-06 00:00:49 +02:00
Álvaro Felipe Melchor
e00123d259 removed unused api from r_list 2016-10-06 00:00:46 +02:00