Commit graph

35 commits

Author SHA1 Message Date
Anton Kochkov
45f1153d41
unit: test_str compiler warnings fixes (#3716) 2023-08-02 20:46:04 +08:00
Peiwei Hu
1938890035
Fix: grep(~) will change the original result when ignores case (#3259) 2022-12-25 08:01:06 +08:00
Khairul Azhar Kasmiran
a58538d387
Fix rz_str_split_list_regex() (#2815) 2022-07-18 22:26:55 +08:00
Rot127
5a38df5294
Fix: register profile comments parsing (#2806)
Parse comments in register profile definitions correctly.
2022-07-18 19:36:56 +08:00
Rot127
ccdd9f2848
Add UTF-8 friendly strchr (#2809)
* Add utility functions to search for UTF-8 chars in strings.

* Break loop if number of read bytes goes beyond str.

* Add doxygen to `rz_mem_cmp`

* Add NULL checks to functions.
2022-07-18 17:53:58 +08:00
Riccardo Schirone
8939fdbd7d
Use add_global_arguments instead of passing cflags/ldflags all around (#2812)
See also 66a0e22293/docs/TESTING_WITH_SANITIZERS.md (clang)
2022-07-17 21:33:51 +08:00
Rot127
f108873520
Rework register profile parsing
**Register profile parsing**

- Types, sizes, and offsets get now parsed separately in their own functions.
- More logging added.
- The string is first parsed into a list of register definitions and alias (`RzRegProfileDef`, `RzRegProfileAlias`) and afterward applied to `RzReg.regset`.
- Documentation was added on how the register profile needs to be formatted.
- Functions are more consistent with return types (most return `bool` now instead of `Error Msg` + `NULL`).

**New register profile structs**

The register profile of `RzReg` consists of two lists with alias and definitions.
I chose lists over NULL-terminated arrays because they were a little easier to handle during parsing (no memory management).
Please let me know if you would strongly prefer the NULL-terminated version.
2022-06-20 20:54:42 +08:00
Riccardo Schirone
47b73ca7fa RzUtil/str: remove len argument from rz_str_filter
All uses of rz_str_filter already passed either strlen(..) or -1 or 0,
which was the same as computing strlen(...). The only case where a
different value was passed was in astr.c, where the string was anyway
allocated with rz_str_ndup(). Thus the string passed to rz_str_filter()
is always zero-terminated and we don't need to compute the length in
rz_str_filter() to traverse it all, but we can just stop at the first
NULL byte.
2022-04-06 01:46:18 +08:00
Riccardo Schirone
64469f2811
Changes in how paths are handled (#1997)
* Remove `RIZIN_EXTRAS` because useless

Extras plugin should be treated as any other regular plugin, they should
not have their own directory. I believe we did not have anyway any
plugin using that directory.

* Do not use `<version>` in `/usr/share`

Users can only install one version of Rizin at a time anyway, thus
splitting the `/usr/share/rizin` directories does not really bring
multi-version install possible. At the same time, we stick to what's
common for other tools, which do not use version in `/usr/share`

* Move plugin directory to `/usr/lib64/rizin/plugins`
* Remove `RZ_HOME_BIN` env var because not useful anymore
* Introduce `rz_util/rz_path` to provide rizin paths
* Use `rz_path_system_sdb_types` whenever it makes sense
* Use some others `rz_path_*` functions instead of custom ones
* Use `rz_path` APIs for themes, fortunes and signatures
* Remove `rz_sys_prefix`
* Reduce the number of defines needed to handle home and system paths
* Reduce the number of `rz_path` functions
* Make the lib debug depending on log level and `RZ_LOG_DEBUG`
* Refactor a bit how directory of plugins are loaded
* Keep supporting old plugins directory for at least 0.4.0
2021-11-30 13:36:38 +08:00
Dhruv Maroo
34d345d884 Format according to clang-format-13 2021-11-25 15:44:28 +08:00
Florian Märkl
3e7cdf58ed Remove strnlen() calls and replace by rz_str_nlen() 2021-10-26 10:50:22 +02:00
Aswin C
31d4143a93
Use str{l,n}cpy() in rz_str_ncpy() instead of a loop (#1395) 2021-08-25 18:21:45 +08:00
Riccardo Schirone
3e41a97e7a
RzUtil: add unit tests for rz_str_ndup/nlen (#1419) 2021-08-10 21:48:06 +08:00
Florian Märkl
24c4f6cc09
Remove all PJEncodings (#1200) 2021-06-09 15:47:49 +02:00
Riccardo Schirone
53bf5c497f SPDX Copyright text for all files based on history
- Add LICENSES directory
- Download additional licenses used
- Add .reuse directory
- Add doc about SPDX/reuse

Co-authored-by: Florian Märkl <info@florianmaerkl.de>
2021-03-05 19:39:15 +08:00
Florian Märkl
e76c435565
Add rz_strf() Macro (#506) 2021-02-02 19:17:44 +01:00
Florian Märkl
1907784363 Use portable Format for Graph Metrics in Zignatures 2021-02-02 09:11:09 -01:00
Anton Kochkov
a0be4e2e64 Run clang-format 2021-01-21 22:05:44 +08:00
Riccardo Schirone
ed8525e46f Rewrite rz_str_split functions with unit tests 2021-01-05 23:33:32 -06:00
Liumeo
619a583acc Fix memleak in test_str & test_debug_session (#18164) 2021-01-05 05:21:41 -06:00
Riccardo Schirone
a7fd3fa3c6 Use mu_main to reduce boilerplate in unit tests
* Disable colors on Windows because terminal looks bad otherwise
* Use environment on Windows to set PATH and make sure unit tests use
  the compiled libraries and not the installed ones
* Define ssize_t on Windows as well by using SSIZE_T

Update test_analysis_block.c

Update test_intervaltree.c

Update test_unum.c
2021-01-03 11:42:38 +01:00
Giovanni
35a9ef94c9
Code and comments cleanup (#108) 2020-12-04 18:11:51 +08:00
Anton Kochkov
1ffe017a1a Additional format string fixes 2020-11-04 09:49:39 +08:00
Hex
afb8b7bd1f Add cfg.json.* encoding options (#17681) ##json 2020-10-30 10:44:38 +01:00
Riccardo Schirone
52ba3f8d39 Rename RStr to RzStr 2020-10-13 12:43:34 +02:00
Riccardo Schirone
b8bf83b856 Rename RStrBuf to RzStrBuf 2020-10-13 12:43:34 +02:00
Riccardo Schirone
dca10c2b5c Add rz_str_wrap API to wrap text at the word level 2020-10-13 10:52:57 +02:00
Anton Kochkov
dcbc330bec Fix build 2020-10-03 11:08:27 +08:00
Riccardo Schirone
721609a17b
Rename to rizin (#2) 2020-10-01 16:13:03 +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
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
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
e866f8f21f Add RIntervalTree data structure ##util (#15541)
* Add RRangeTree
* Inclusive/Exclusive
* Add r_interval_tree_delete and r_interval_tree_resize
* Fix r_interval_tree_all_at()
2019-12-09 00:07:10 +01:00
Florian Märkl
ae61aa8e37
Imports Tests from radare2-regressions (#15546) 2019-12-08 15:31:14 +01:00