Commit graph

277 commits

Author SHA1 Message Date
Dhruv Maroo
34d345d884 Format according to clang-format-13 2021-11-25 15:44:28 +08:00
David CARLIER
7458712017
Fix thread api on DragonFlyBSD (#2009) 2021-11-22 14:59:28 +01:00
billow
46533d41eb
EBCDIC character support (#1643) 2021-11-22 09:48:57 +08:00
Khairul Azhar Kasmiran
906ece4211
Add asan build for clang (#1910) 2021-11-17 21:02:02 +08:00
Giovanni
87311c3759
Basefind (#1966)
Co-authored-by: gnole <olegbouchin@gmail.com>
2021-11-15 22:33:38 +01:00
Giovanni
8f4620d043
Add thread pool and physical core number (#1973) 2021-11-14 12:06:19 +01:00
Florian Märkl
d82eea1415
Remove unused RzCache and rz_prof_t (#1971) 2021-11-13 15:44:15 +01:00
DC
841508ddfd util: rz_th_setaffinity warning fix 2021-11-11 09:18:02 +01:00
Riccardo Schirone
9ea989f58d Document rz_hex_str2bin and add unit tests 2021-11-09 12:01:41 +01:00
Anton Kochkov
66bc96f06f
Various fixes RzCons, RzUtil, RzConfig (#1940)
* Fix CID 316906
* Fix CID 316025
* Fix CID 316354
* Fix CID 357820
* Fix CID 316852
* Fix CID 316944
* Fix CID 316836
2021-11-05 17:59:05 +08:00
Anton Kochkov
b4c6c38a58
Various fixes in RzUtil (#1938)
* Fix CID 315916
* Fix CID 316056
* Fix CID 316254
* Fix CID 316499
* Fix CID 316542
* Fix CID 316618
* Fix CID 316641
* Fix CID 316642
2021-11-04 22:54:09 +08:00
Khairul Azhar Kasmiran
6bbe4ffbb6
intervaltree.c: Check for NULL before using container_of (#1937) 2021-11-04 10:40:59 +01:00
Anton Kochkov
91ef6da7ad
Various memleak fixes (#1893)
* Fix CID 361180
* Fix CID 359879
* Fix CID 358574
* Fix CID 358570
* Fix CID 358569
* Fix CID 358559
* Fix CID 354016
* Fix CID 352581
* Fix CID 352498
* Fix CID 352484
* Fix CID 352451
* Fix CID 348953
* Fix CID 348937
* Fix CID 348935
* Fix CID 344518
* Fix CID 316930

Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
2021-10-27 16:32:45 +08:00
Anton Kochkov
6f4a24c58e
Use strnlen() wherever available (#1894) 2021-10-27 10:17:24 +02:00
Anton Kochkov
fff938a8b9
Fix ASAN buffer overflow in rz_buf_get_nstring() (#1891) 2021-10-27 13:27:39 +08:00
Florian Märkl
d5dea0a088 Fix realpath usage for old BSD/Mac OS X 2021-10-26 10:50:22 +02:00
Florian Märkl
08cbaa701e Set HAVE_ENVIRON to false for macOS (it's not available in shared libs) 2021-10-26 10:50:22 +02:00
Florian Märkl
e2ce224b71 Check for macOS Version for pthread_(s|g)etname_np 2021-10-26 10:50:22 +02:00
Florian Märkl
3e7cdf58ed Remove strnlen() calls and replace by rz_str_nlen() 2021-10-26 10:50:22 +02:00
Dhruv Maroo
48656fdb80
Port shell commands to new shell (#1875)
* Create new category for shell commands in new shell
* Port `env` and `exit`
* Port `ls`, `rm`, `sleep`, `uniq`, `uname` to new shell
* Rename `cname`s for shell commands
 * Port `cp`, `cp.` and `echo`
* Port `cd` to newshell
* Add `~` (paths relative to home) handling in `rz_sys_chdir`
* Add `RZ_NONNULL` for `rz_sys_chdir`
* Port `cat`
* Port `mv` and `mkdir` to new shell; Remove old handlers
* Port `pwd`
* Port `sort`
* Remove `cp.` command
* Add `RZ_NONNULL` for arguments of `rz_syscmd_*` functions
* Port `cls` and `clear`
* cd to home when no argument provided
* Fix `mkdir`
* Add alias handling for `cat`
* Fix `mv` command
2021-10-26 12:04:24 +08:00
Anton Kochkov
c4c6073074
Various memory leaks and UAF fixes (#1876)
* Fix CID 359880
* Fix CID 359879
* Fix CID 359878
* Fix CID 358605
* Fix CID 358598
* Fix CID 358593
* Fix CID 358591
* Fix CID 358591
* Fix CID 358574
* Fix CID 358573
* Fix CID 358570
* Fix CID 358561
* Fix CID 358551
* Fix CID 358551
* Fix CID 358541
* Fix CID 358531
* Fix CID 358525
* Fix CID 358521
* Fix CID 357819
* Fix CID 357816
* Fix CID 357646
* Fix CID 357646
* Fix CID 357645
* Fix CID 357643
* Fix CID 356605
* Fix CID 356312
* Fix CID 354046
* Fix CID 354036
* Fix PDB unit tests
2021-10-24 10:22:30 +08:00
Riccardo Schirone
75fc447873
Fix some memleaks in unit tests (#1869)
* Cleanup RzAnalysisRzil when freeing RzAnalysis

* Fix str leaking in rz_core_write_string_at

* Fix buf leaking in rz_core_yank_paste

* Fix memleak in json unit tests

* Fix features leaking in RzBinInfo

* Fix features leaking in RzAsm

* Fix memleaks in RzTable

* Fix test_str_search memleaks

* Fix memleak in test_io.c

* Fix memleaks in RzBuf and test_buf.c

* Fix memleaks in test_cmd.c

* Fix memleaks in test_config.c

* Fix memleaks in RzCons

* Fix hashes leaking in test_bin.c

* Fix memleaks in test_id_storage.c

* Fix memleaks in test_il*.c and adjust APIs
2021-10-22 09:33:20 +08:00
Anton Kochkov
514f9fa75b
Remove unused RzBinheap API (#1865) 2021-10-21 15:14:57 +02:00
Anton Kochkov
c14a09f946 Remove unused RzFList 2021-10-21 16:45:09 +08:00
Anton Kochkov
6bfa555562 Minor update of the RBTree API 2021-10-21 16:45:09 +08:00
Khairul Azhar Kasmiran
637c192145
bin.str.enc: Rename latin1 to the more generic 8bit (#1847)
* Rename `rz_str_escape_latin1()` to `rz_str_escape_8bit()`
* test_serialize_analysis.c: Change string from "latin1" to "8bit"
* `bin.str.enc`: Rename `latin1` to the more generic `8bit`
2021-10-18 12:07:52 +08:00
Khairul Azhar Kasmiran
cb46249098
Rename Csa to Csb (#1844) 2021-10-16 15:50:59 +08:00
Anton Kochkov
022c606372 Rename RzStrEncOptions to RzStrEscOptions 2021-10-16 11:33:48 +08:00
Anton Kochkov
39613b5c16
Port C (metainformation) commands to the rzshell (#1752)
* Do not escape strings during the search
* Port `C` (metainformation) commands to the rzshell
* Improve string autodetection
* Remove `Cr` and RZ_META_TYPE_RUN
* Escape `\x1b` as `\e` character in strings
* Move string encoding options to `RzStrEncOptions` struct
* Add `esc_double_quotes` option to `RzStrEncOptions`
* Do not filter out unprintable characters for uppercase check
* Use `esc_double_quotes` when printing the string between '"' in disasm
* Use signed chars on all platforms/architectures

Co-authored-by: Riccardo Schirone <sirmy15@gmail.com>
2021-10-15 16:48:18 +08:00
Khairul Azhar Kasmiran
ddee12ccdc
pj_(k)r: Use ut8 instead of unsigned char (#1788) 2021-10-02 10:51:24 +02:00
Khairul Azhar Kasmiran
65cbec7267
Rename pj.h to rz_pj.h (#1783) 2021-10-01 21:35:39 +08:00
Giovanni
e224ee7b28
Add demangling as plugins and libdemangle as external dependency (#1656)
* Added demangling as plugins and libdemangle as external dependency
* Added iDl to return the list of demanglers
* moved demangling tests into rz-libdemangle and keep only bin tests
2021-10-01 10:45:38 +00:00
Khairul Azhar Kasmiran
72ee3eb2e3
Simplify escape_utf8_for_json() a bit (#1778) 2021-09-30 23:31:13 +08:00
Khairul Azhar Kasmiran
caf1ffbeb3
rz_utf8_decode(): Remove Java \0 overlong special case by adding mutf8 decoder (#1773) 2021-09-29 21:12:49 +08:00
Khairul Azhar Kasmiran
300714c38c
rz_utf8_decode(): Declare overlong encodings as invalid UTF-8 (#1764) 2021-09-29 09:25:03 +08:00
David CARLIER
1bdb6d13a2
haiku and dragonflybsd build fixes. (#1767) 2021-09-28 21:54:49 +02:00
Khairul Azhar Kasmiran
0a12ca44c5
ij: Represent non-utf8 binary filename as number array (#1760) 2021-09-28 00:34:05 +08:00
Florian Märkl
cf7842e248 Fix sparse buffer size 2021-09-26 10:45:40 +02:00
GustavoLCR
a7dd835235
Fix incompatible return type warnings (#1721) 2021-09-19 10:52:28 +08:00
Alexis Ehret
09d5b01b67 Add macro to simplified rz_buf_read_* and rz_buf_write_* definition 2021-09-17 16:18:03 +02:00
Alexis Ehret
47c58d3a51 Add rz_buf_write_* API to read ut16, ut32, ut64 from a buf 2021-09-17 16:18:03 +02:00
Anton Kochkov
a4203f557c
Do not use VLA - MSVC does not support them (#1706) 2021-09-17 19:17:02 +08:00
Luca Borzacchiello
f211163b70
UTF-16 be, UTF-32 be support (#1535)
* Refactored string search

string search logic moved from librz/bin/bfile.c to
librz/util/str_search.c

* UTF-16BE and UTF-32BE support

* Decoupled rz_str_search with rz_bin

* Changed parameter order in rz_scan_strings

* Fixed needle reset in rz_string_search

Now when the string search fails, needle is restored to original_needle+1,
i.e., we continue the searching process starting from the next byte.

* Changed heuristic for UTF BE detection

one more byte in for the detection (6 instead of 5)

* Fixed unit test in str_search

* Refactored rz_scan_strings and better UTF16-LE and UTF16-BE detection

Now if there is an ambiguity between UTF16-LE and UTF16-BE, we take the
longest one.

* Changed UTF BE heuristic

If there is any ambiguity about big-endian or little-endian, always
choose little endian

* Small format fixes in str_search

* Added preferred endianess switch in RzUtilStrScanOptions

* Fixed str_search regression tests
2021-09-17 16:37:35 +08:00
GustavoLCR
a7602055e8
Unicode fixes for Windows (#1703)
* Remove unnecessary calls to `rz_acp_to_utf8()` from function on Windows

This is unnecessary since d7e7bae79e

* Make `rz_file` APIs use `W` variant of Windows APIs

* Rename variables from `var_` -> `wvar`
2021-09-17 15:05:00 +08:00
pancake
7483713268 Move linux specific thing used only in the debugger out of RUtil
Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
2021-09-15 10:31:26 +08:00
Khairul Azhar Kasmiran
7b2994283b
rz_time_stamp_to_str: Use 31-Dec-1969 epoch instead of hack (#1679) 2021-09-14 21:30:26 +08:00
Khairul Azhar Kasmiran
086701e7de
Move pt UTC timezone tests out of archos/ (#1668)
* Move `pt` UTC timezone tests out of `archos/`
* Do Windows hack if `__OpenBSD__`
2021-09-13 22:51:00 +08:00
David CARLIER
61ead00591 io: fix ptrace wrap call types for Darwin.
little nit with abs calls dealing with long data.
2021-09-12 15:19:04 +02:00
Khairul Azhar Kasmiran
f70a4da1d2
Add UTC timezone to timestamps (#1639) 2021-09-11 23:29:16 +08:00
Giovanni
6e4cad4474
CID 315924: Out-of-bounds access (OVERRUN) (#1653) 2021-09-11 09:31:19 +02:00