Commit graph

64 commits

Author SHA1 Message Date
Thomas Strömberg
a65be1e6cd
Fix Illumos/Solaris platform support (#5972) 2026-02-27 13:01:40 +08:00
Giovanni
827a0ed1bb
Fix doxygen comments to use \<something> notation (#5720) 2026-01-02 19:05:37 +08:00
Khairul Azhar Kasmiran
b96202ad48
Rename rz_list_first() / rz_list_last() to rz_list_first_val() / rz_list_last_val() (#5654) 2025-12-20 17:08:59 +08:00
billow
7a77b8f7bd
linter: update clang-format installation to version 20 (#5451)
* fix: format with clang-format-20
* fix: fix clang-format linter with rewrite '^#define.*/\*.*\\$'
* fix: update clang-format to version 20 in workflows and documentation
* fix: add SPDX license information to .git-blame-ignore-revs
2025-10-12 08:02:03 +08:00
Rot127
92eff78276
librz/util: UTF-16/32 to UTF-8 conversion (#5431)
* Replace rz_str_utf16_to_utf8 with one matching the other string convert functions.
* Add rz_str_utf32_to_utf8
2025-10-05 19:16:53 +08:00
Ahmed Mohamed Ibrahim
38a530dbe3
librz/util: base64, base85, base36, base32, base16 support and refactor (#5216) (#5271)
* Rename librz/util/ubase64.c into librz/util/base64.c for consistency #5216

* Add Doxygen documentation to function in librz/util/base85.c #5216

* Add unit-tests for librz/util/base85.c #5216

* Refactor base85 API and internal functions #5216

base85 was using a FILE as an input and it used to print its result to
STDOUT, which was very bad for having unit-testing or to use it to
extend rz-hash functionality, since the solution I really had was
through using pipes which isn't ideal as much as the refactoring one.

* Extend rz-hash with base85 #5126

* Fix formatting #5216

* Extract base36 decoding function from subprojects/rzwinkd/iob_net.c to librz/util/base36.c #5216

- Also, added Doxygen docs to rz_base36_decode function

* Added rz_base36_encode_dyn #5216

- this function encode a u64 value to it's char[13+1] base36 counterpart
- later, it will be helpful in expanding the funcitionality of rz-hash
- added its Doxygen docs

* Expand rz-hash with base36 encoding/decoding #5216

* Refactor rz_base36_decode to return a suitable error code like -1 #5216

- that should help testing it later for valid and invalid decodings
- keeping the original behaviour as it was in
subprojects/rzwinkd/iob_net.c

* Add unit-tests for base36 encoding & decoding functions #5216

* Fix formatting #5216

* Fix base36.h header file guards #5216

* Add base32 encoding & decoding #5216

added their Doxygen Docs as well

* Add base32 encoding and decoding unti-tests #5216

* Expand rz-hash with base32 encoding/decoding functionality #5216

* Fix formatting #5216

* Fix add base32 to codec_name_bytes #5216

* Fix base32 docs #5216

* Add base16 encoding/decoding functions #5216

- added their Doxygen docs as well.

* Add base16 unit-tests #5216

* Fix test_base85 conversions warnings #5216

* Expand rz-hash with base16 encoding/decoding functionality #5216

* Fix formatting #5216

* Fix doxygen docs #5216

* Restore subprojects/rizin-shell-parser/parser.c to match origin/dev

* Fix the order by baseXX

* Fix base16 - invert the logic in calculate_src_length

* Fix base16 - intialize variables in rz_base16_encode

* Fix base16 - null terminate the output buffer of rz_base16_encode_dyn

* Fix base16 - get rid of unnecessary else in rz_base16_decode

* Fix base16 - use `len & 1` instead of `(len % 2) != 0`

* Fix base32 - invert the logic in calculate_src_length

* Fix base32 - compress two return statments by using `rz_return_val_if_fail(src && dest, 0);`

* Fix base32 - null terminate the output of rz_base32_encode

* Fix base32 - get rid of unnecessary else in rz_base32_decode

add more parentheses to split addition from mult for better clarity

* Fix base32 - intialize variables in rz_base32_encode_dyn

* Fix base36 - intialize `tmp` variable in rz_base36_encode_dyn

* Fix base36 - use RZ_LOG_ERROR instead of eprintf

* Fix base36 - use RZ_NULLABLE for the API interface

* Fix base85 - use RZ_OUT & RZ_NULLABLE for the API interface

* Fix base85 - use RZ_LOG_ERROR instead of eprintf

* Fix base85 - use size_t instead of int for decode_tuple_buf

* Fix base85 - remove unused varaible, `out_len`, in rz_base85_encode_dyn

* Fix base85 - correct decode buffer size calculation

The previous rz_base85_dec_buflen() underestimated the worst‑case output
size (3 bytes per 4 input chars), causing overflows when using ‘z’/’y’
abbreviations. Update it to allocate 4 bytes per input character plus
one for the NUL terminator, eliminating heap-buffer-overflow errors.

* Fix formatting

* Fix base85-test - use `newlines` variable to make sure line breaks were inserted as expected

* Fix base85-test - remove unnecessary includes

* Fix rz-hash test - updated rz-hash -L expected result

* Fix crypto_base36 - use RZ_LOG_ERROR instead of eprintf

* Fix base16 - compress rz_return_val_if_fail statements and move before locals

* Update base16 - use hex.c existing encoding/decoding logic

- base16.c encoding/decoding functions are now wrappers for hex.c
  `rz_hex_bin2str` and `rz_hex_str2bin` functions
- updated related base16 unit testing and documentation
- updated the integraion with rz-hash binary (or crypto_base16)

* Fix formatting

* Add documentation to rz_hex_bin2str

* Fix base85 - add missing `reutrn` docs to rz_base85_encode function

* Fix base85 - use RZ_NONNULL for dest and src function instead of RZ_NULLABLE

* Fix base36 - use RZ_NONNULL for dest and src function instead of RZ_NULLABLE

* Fix base16 - use RZ_NONNULL for dest and src function instead of RZ_NULLABLE

* Fix base32 - use RZ_NONNULL for dest and src function instead of RZ_NULLABLE

* Fix base16 - add missig checks for invalid inputs in rz_base16_encode & rz_base16_encode_dyn

* Fix base32 - add missing checks for bad encoding

* Fix - add missing SPDX

* Fix Formatting

* Add rz_base36_encode & rz_base36_decode_dyn functions to base36 API
2025-08-17 15:26:25 +08:00
Khairul Azhar Kasmiran
dcaf7b94d9
asan ci: Show ODR violations (#5010)
* asan ci: Show ODR violations
* Add `static const` to rzwinkd profiles
2025-03-18 22:51:57 +08:00
amibranch
8e6b764fb5
build: Improved meson-build to use rizin as subproject (#4684)
* Setting GNU99/C99 standard for subprojects
* Remove use of `add_global_arguments`
* Added extern "C" linkage specification to some public headers of rizin
* Changed the meson_git_wrapper.py-script to explicitly specify the output-path
* Made the RIZIN_BUILD_PATH conditional in the integration-test meson-build

Co-authored-by: amibranch <amibranch@users.noreply.github.com>
2024-10-29 23:59:42 +08:00
Anton Kochkov
25fd417a28
Add user pointer to RzListComparator (#4204) 2024-02-11 13:28:33 +08:00
Siddharth Mishra
9ab709bc34
Improve cmd_help.yaml and fix random number generator (#3452)
* Improve cmd_help.yaml and fix a small bug
* Add support for 64bit random numbers
* Make a distinction between 32- and 64-bit PRNG
* Add documentation for new functions
* Change the RBTree test to use 32-bit random numbers
2023-04-07 20:22:01 +08:00
Riccardo Schirone
c4767cf1ac
Fix plugin removal and clean code (#3277)
* cmd: Fix summary of few "L" sub-commands
* util: start decluttering plugins handling

- Add Doxygen docs
- Remove unused API functions and make others internal only
- Use RzLibType enum for plugin type instead of int

* util: move dlopen/dlsym/dlclose to rz_sys
* util: make rz_lib_open/close return bool
* util: simplify rz_lib_add_handler and rz_lib_open*
* libs: implement rz_*_plugin_del to remove a plugin
* core: remove commands from RzCmd when removing plugins
* librz: call plugins 'fini' method when removing a plugin
* core/cmd: do not fail if the hashmap removal fails

When removing a group command, the inner command might have the same
name, thus it would result in trying to remove the same name twice.
Ignore it, as it is fine.

* librz: make RzCrypto plugins handling like the others
* librz/crypto: add rz_crypto_reset and use it
* librz: allocate the plugin structures before adding them
2023-01-16 13:32:46 +01:00
Giovanni
55e690990b
Fix endianness for win pagedump and winkd (#3204) 2022-12-09 11:41:28 +01:00
Dean
59b38e6efa
Add /*<type>*/ comments everywhere (#2986)
Adds /*<type>*/ comments and a linter check from rz-bindgen to enforce
their existence and consistency

Also includes the following fixes made when adding the annotations:
* removed unused intern_table arguments in pyc_dis.c, pyc_dis.h, asm_pyc.c
* removed unused classes argument from place_nodes in agraph.c
* removed unused recurse and recurse_bb functions in canalysis.c
* removed unused vars field from RzPrint struct
* removed unused RzAnalysisType* structs from rz_analysis.h
* removed unused list field from RzEgg struct
* fixed bug in bp_plugin.c where duplication-checking logic iterates over the wrong list
* removed unused q_regs field from RzDebug struct
* removed unused backtrace field from RzDebugPlugin struct
* removed unused classes_list field from RzBinNXOObj struct
* removed unused methods_list and classes_list fields from RzBinZimgObj struct
2022-09-11 13:04:53 +08:00
Riccardo Schirone
2987e035da hash: use RzHash in most hash APIs 2022-06-28 21:55:26 +08:00
Riccardo Schirone
9ea7c2fa5a RzHash: rename everything in librz/hash to RzHash prefix 2022-06-28 21:55:26 +08:00
Riccardo Schirone
fdd7c6200c
Fix compilation on Termux and Haiku (#2671)
* build: fix compilation on Termux by using meson checks
* build: fix compilation on termux, which is recognized as linux

meson identifies termux as "linux" system, however pthread_sigmask is
not available there. Since pthread-fixes.c just defines
uv__pthread_sigmask we include it also in regular linux builds, because
the function is then used automatically instead of pthread_sigmask only
when __ANDROID__ is defined.

* subprojects/rzwinkd: define cc in meson.build before use
2022-06-07 23:44:41 +02:00
GustavoLCR
3bc60f6800 WinKD: Add nullability/ownership markers to functions 2022-06-05 00:27:35 +08:00
GustavoLCR
ab498718c3 WinKD: Use ut* macros instead of uint_* types 2022-06-05 00:27:35 +08:00
GustavoLCR
f10e5d865a Debug: Allow dce in all platforms
* Used for `WinKD` and `Windows` debug
2022-06-05 00:27:35 +08:00
GustavoLCR
953ffb47fb WinKD: Switch to current process and thread 2022-06-05 00:27:35 +08:00
GustavoLCR
cd1f5469ab WinKD: Use kernel module address from version packet 2022-06-05 00:27:35 +08:00
GustavoLCR
811a9a2819 WinKD: Fixes for packet sending/receiving
* Ignore resent packets
* Resend packet if we didn't get an ACK
* Break if Ctrl-C is pressed
* Always wait for a state change packet in debug event wait function
2022-06-05 00:27:35 +08:00
GustavoLCR
e63faa6005 WinKD: Fix incomplete register write
* Fix register read size
2022-06-05 00:27:35 +08:00
GustavoLCR
4f3c4935af WinKD: Fix incomplete reads 2022-06-05 00:27:35 +08:00
GustavoLCR
dbed351f19 DMP/WinKD: Basic memory mapping info 2022-06-05 00:27:35 +08:00
GustavoLCR
43b9f6487a WinKD: Fix OOB write 2022-05-11 18:39:51 +08:00
GustavoLCR
d70e0b01ba WinKD: Fix kd connection through a pipe 2022-05-11 18:39:51 +08:00
GustavoLCR
be498444ec WinKD/DMP: Add Windows 10 20H2 and 21H2 profiles 2022-05-10 10:22:49 +08:00
GustavoLCR
0cb346e39a WinKD: Only modify seq_id after receiving an acknowledgment packet 2022-05-10 10:22:49 +08:00
GustavoLCR
de1b2e8d50 WinKD: Timeout if amount of tries to get packet exceeeds limit 2022-05-10 10:22:49 +08:00
GustavoLCR
a19ac23ee8 WinKD: Verbose log if address is not mapped 2022-05-10 10:22:49 +08:00
GustavoLCR
a9ea591ade WinKD: Keep a cache of current thread context 2022-05-10 10:22:49 +08:00
GustavoLCR
3cabf34561 WinKD: Remove winkd_lock_tryenter()
* Use `winkd_lock_enter()` and make it possible to break it through `RzCons`
2022-05-10 10:22:49 +08:00
GustavoLCR
210f87573e WinKD: Use DBGKD_VERS_FLAG_PTR64 to identify 64-bit machines 2022-05-10 10:22:49 +08:00
GustavoLCR
4c95c19251 WinKD: Factor out some common code into a function 2022-05-10 10:22:49 +08:00
GustavoLCR
0296e87b26 WinKD: Save kernel module info from state change packet 2022-05-10 10:22:49 +08:00
GustavoLCR
b6a84d284c WinKD: Handle reset packet type 2022-05-10 10:22:49 +08:00
GustavoLCR
c7a6312af5 WinKD: Add verbose logging to winkd_wait_packet() 2022-05-10 10:22:49 +08:00
GustavoLCR
e9cffc0afa WinKD: Create profile dynamically if not found
* Download kernel module and PDB
* Load kernel PDB info
2022-05-10 10:22:49 +08:00
GustavoLCR
61235f02a0 WinKD: Fix pids/tids cache
* Fix double-free of name in debug modules list
2022-05-10 10:22:49 +08:00
GustavoLCR
10cfd66598 WinKD: Avoid unnecessary re-syncing 2022-05-10 10:22:49 +08:00
GustavoLCR
c2d36fa024 WinKD: Fix reading kernel module list 2022-05-10 10:22:49 +08:00
GustavoLCR
c2ab12b01f WinKD: Fix data race in kdnet backend 2022-05-10 10:22:49 +08:00
GustavoLCR
bb388edcd4 WinKD: Send acknowledge response for all packets 2022-05-10 10:22:49 +08:00
GustavoLCR
170ab3eb3b
Remove windows.h include from rz_types.h (#2410)
* Create `rz_windows.h`
* Move `RzThread` structure definitions to internal header
* Create and use `rz_th_get_user()` API to avoid exposing `RzThread` layout in external header
* Make `rz_th_self()` an IPI
* Use `_wmkdir()` in `rz_sys_mkdir()` on Windows
* Remove unused `winkd_break_read` function
* Remove `RzIORap` definition from `rz_io.h`
* Remove include of `Windows.h` from `rz_types.h`
* Use `rz_windows.h` when necessary
* Remove `RzCoreRtrHost` definition from `rz_core.h`
* Remove `rz_socket.h` include from `rz_core.h`
2022-03-16 13:54:41 +01:00
GustavoLCR
dd81b6629a
Implement getting a backtrace from a Windows Kernel Dump for x64 (#2387)
* PE: Add header to mappings
* PE: Add temp defs for unknown `UNWIND_CODE_OPS`
* Core Bind: Add `RzCoreBinApplyInfo` binding
* DMP/WinKD: Always add kernel modules to mod list
* Implement Windows x64 SEH backtracing
* Fix `ompb` not prioritizing maps
* Optimize `rz_io_map_priorize()`
* DMP: Implement backtrace for x64
2022-03-15 10:45:02 +01:00
GustavoLCR
0129c3fa31 DMP/WinKD: Fix UTF16 decoding module name on Linux 2022-03-03 21:52:41 +08:00
GustavoLCR
c510827056 DMP/WinKD: Always include current thread/process 2022-03-03 21:52:41 +08:00
GustavoLCR
b634893cad DMP/WinKD: Read running status of threads 2022-03-03 21:52:41 +08:00
GustavoLCR
68a9966bc8 DMP/WinKD: Fix incorrect extra thread being listed 2022-03-03 21:52:41 +08:00