Commit graph

276 commits

Author SHA1 Message Date
bubblepipe
4aab82b9b2
heap: jemalloc parser refactor, add FreeBSD support (#5864) 2026-02-05 00:44:27 +08:00
Naren Sirigere
f6c4f76380
Updated to pcre2 10.47 (#5830) 2026-01-27 14:44:51 +00:00
bubblepipe
dca635cde9
Arch-agnostic jemalloc heap parser (#5828) 2026-01-27 15:31:48 +08:00
NOT XVilka
3ed43c4c77
Update Capstone v6 from Alpha5 to Alpha6 (#5842)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-01-27 12:08:05 +08:00
bubblepipe
f28915f246
heap: refactor jemalloc 4.5.0 heap parser (#5800) 2026-01-19 23:45:20 +08:00
bubblepipe
2ee0d4a42b
heap: add support for jemalloc v5.3.0 heap parsing (#5744) 2026-01-18 16:44:57 +08:00
bubblepipe
912513fc6f
heap: refactor parser for jemalloc 4.5.0 (#5722)
* replace size_t -> GHT, ssize_t -> GHST, void * -> GHT
* delete subprojects/rzheap/rz_jemalloc/jemalloc_* as they are included inside subprojects/rzheap/rz_jemalloc/jemalloc.h
* macro wrapper for jemalloc code

tested working for arena_run_t

echo '#include <rz_heap_jemalloc.h>' | gcc -E -I librz/include -I subprojects/rzheap -I build -x c - 2>&1 | grep arena_run_t

* replace all struct definition t inside GH(t)\
\
DIR="subprojects/rzheap/rz_jemalloc/internal"
SYMBOLS="symbols"
while read -r type; do
    [ -z "$type" ] && continue
    echo "Replacing: $type -> GH($type)"
    perl -pi -e "s/(?<!GH\()(?<![A-Za-z_])${type}(?![A-Za-z_0-9])/GH(${type})/g" "$DIR"/*.h
done < "$SYMBOLS"
2026-01-07 00:24:12 +08:00
Giovanni
827a0ed1bb
Fix doxygen comments to use \<something> notation (#5720) 2026-01-02 19:05:37 +08:00
Maijin
07d3a812f7
subprojects: update libzip 1.11.4 (#5701)
Update libzip to 1.11.4

---------

Co-authored-by: Maijin <maijin21@gmail.com>
2025-12-30 05:29:39 +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
IndAlok
666d0ba8a0
Implement unified API for describing addresses (name+offset format) (#5571)
* core: Add unified API for describing addresses (resolves rizinorg#4993)
* core: Fix pxW and prompt tests by adding backward-compatible delta limit

This commit fixes the test failures caused by behavioral changes in the
unified address description API:

1. pxW tests failing (cmd_pxw, helloworld-gcc-elf):
   - The old pxW code had a hardcoded 8192 limit for flag delta
   - Added max_flag_delta option to RzAddrDescribeOptions
   - rz_core_addr_get_flag_offset() now uses max_flag_delta=-1 (8192 limit)

2. prompt settings test failing (test/db/tools/rz):
   - The old prompt code used spaces around +/- (e.g., 'entry0 + 1')
   - Added use_spaces_around_delta option to RzAddrDescribeOptions
   - Added rz_core_addr_get_flag_offset_prompt() for prompt display

* core/caddr: Add proper error handling and API improvements

- Add RZ_NONNULL annotations to helper function parameters
- Add null pointer checks after rz_str_dup() to detect allocation failures
- Change helper functions to return bool for error propagation
- Handle memory allocation failures in rz_core_addr_describe() by
  checking helper return values and cleaning up on failure
- Use RZ_STR_ISEMPTY macro for consistent empty string checks
- Extract rz_core_addr_description_to_pj() as separate API for
  converting RzAddrDescription to JSON format

* core: Add unified API for describing addresses (resolves rizinorg#4993)
 core: Fix pxW and prompt tests by adding backward-compatible delta limit

This commit fixes the test failures caused by behavioral changes in the
unified address description API:

1. pxW tests failing (cmd_pxw, helloworld-gcc-elf):
   - The old pxW code had a hardcoded 8192 limit for flag delta
   - Added max_flag_delta option to RzAddrDescribeOptions
   - rz_core_addr_get_flag_offset() now uses max_flag_delta=-1 (8192 limit)

2. prompt settings test failing (test/db/tools/rz):
   - The old prompt code used spaces around +/- (e.g., 'entry0 + 1')
   - Added use_spaces_around_delta option to RzAddrDescribeOptions
   - Added rz_core_addr_get_flag_offset_prompt() for prompt display
2025-12-10 19:11:31 +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
Khairul Azhar Kasmiran
811bd2e7b5
Revert -Wno-error cancel flag (#5408)
* Revert `-Wno-error` cancel flag
* Set `werror=false` in rizin-grammar-c subproject
2025-09-25 20:17:06 +08:00
NOT XVilka
58644c8fe2
subprojects: fix PCRE2 cross build (#5379)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2025-09-16 00:21:17 +08:00
Rot127
699c7d2dff
Improve performance of string search. (#5262)
* Make checks against defined Unicode points optional

* Allow to decode UTF-16 without writing the result.

* Remove PCRE2_NO_UTF_CHECK as default, since it can lead to undefined behavior.

* First refactor regex to support utf16 and utf32

* Add UTF-16-BE encoding function

* Add UTF-8 counting helper functions.

- One for counting the number of Unicode code points.
- The other to get the number of bytes required to represent the given UTF-8 string in UTF-16.

* Remove unused code

* Add UTF-8 to UTF-16 conversion function.

* Add type annotations

* Implement utf8 to utf32 string conversion

* Add UTF-16/32 versions of all other necessary regex functions for str search.

* Another regex refactor for utf16/32

* Add UTF16/32 regex matching tests.

* Implement still segfaulting (possibly JIT double usage) regex search.

* Duplicate match_first functions to reduce necessary branch predictions.

* Reduce number of required branches for encoding UTF16/32 to one.

* Duplicate match_all_internal functions to reduce necessary branch predictions.

* Fix too early free

* Only allocate match vector when needed.

* Fix: use code point size of buffer.

* Add missing return

* Normalize pointers to UTF16/32 strings to use proper code point with

* Also replace spaces with in utf16/32

* Add an additional host endian tests for UTF16/32 string encodings.

* Ensure thread savety.

JIT compiled patterns need to be owned by a single thread.
For the search we need to clone it.

JIT matching structures are optionally cloned as well.

* Enforce NO_UTF_CHECK in regex search.

This improves performance and currently is
default because we always match on binary data.

* Fix matching of UTF strings which are not suported by direct buffer matching.

PCRE2 only supports matching against memory which is aligned
to a code point width of the encoding.

These changes prevent taking the fast (direct matching with PCRE2) path
and use the slow string search path if the alignment doesn't match
the UTF string encoding.

To not complicate the change and additional alignment member
is added to each searched string in the search collection.

* Create search hit description on the stack

* Unset complete JIT matching if user provided custom jflags.

* Document what passing NULL to copy function pointers does.

* Replace the retarded idea of tracking offsets with a hashmap with a linear buffer.

This improves performance something like 10x.

* Remove const for the non-JIT builds.

* Remove additional flags for skip checking.

It is not needed because each decoded character is checked for printablity below anyways.

* Enfore no setup of IO mem with 0xff

* Fix: Set JIT complete flag for multi regex patterns

* Fix heap.

* Add note about worsed performance path.

* Fix unit test with string terminated by undefined code point.

* Run clang-format

* Fix order of arguments

* Add warning about string search with encoding=guess to tests.

* Fix string lengths, they no longer count the final invalid code point.

* Fix endian macro on Windows

* Fix NULL dereference

* Fix number tests

* Use endianness check not dependent on stdbit

* Fix type annotations.

* Reintroduce rz_str_len_utf8char

* Fix command description.

* Fix and unify RZ_SYS_ENDIAN macros.

- Don't allow unhandled architectures anymore.
- Check endianness for Sparc and PPC using non GCC/Clang compilers.
- Fix several endianness checks using the value instead of the macros.

* Fix tests

* Apply review comments.
2025-09-11 22:29:20 +08:00
Rot127
095d53a075
subprojects: bump to PCRE2 10.46 (#5333) 2025-09-02 09:51:15 +08:00
Khairul Azhar Kasmiran
369f290ac4
Add -Wno-error to relevant meson.build and unpin meson (#5327) 2025-08-29 20:46:40 +08:00
Giovanni
d933ccc4e5
Remove rz-libswift to avoid embedding C++ projects. (#5320)
* Remove rz-libswift to avoid embedding C++ projects.
* Fix test
2025-08-27 10:38:10 +08:00
Rot127
72bf85309b
Bump Capstone to latest next (v6-Alpha5 + two fixes). (#5308)
- Fix LoongArch absolute address usage.
- Sparc: update to use new Auto-Sync module.
- Sparc: Fix unconditional delayed branch instructions with annul bit.
2025-08-22 09:29:04 +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
Giovanni
3efdc9a318
Add rz-libswift as dependency and disable globally use_swift_demangler (#5298) 2025-08-16 00:03:55 +08:00
Rot127
0c0f868646
Add ?**, ?**e, ?*** for interactive search of command and settings details (#5062)
* Add ?** as alias for ?*~...

* Zero initialize the help desc copy.

Fixes a bug when detail_cb was called but it was just garbage.

* Implement ?***

* Add tests for interactive command search

* Add string buffer output mode for internal use and use it for setting help.

* Add ?**e for interactive search of config values.
2025-07-08 12:06:39 +00:00
NOT XVilka
ba8c170852
Migrate from Capstone to Zydis (x86 architecture) (#5164)
* Added build files [Capstone to Zydis]

* x86 Analysis [Capstone to Zydis]

* Changed x86 RzIL [Capstone to Zydis]

* Changed asm and arch files [Capstone to Zydis]

* Compilation, build error and test fixes [Capstone to Zydis]

* Test changes [Capstone to Zydis]

* Remaining changes [Capstone to Zydis]

* Added BE support [Capstone to Zydis]

---------

Co-authored-by: tushar3q34 <tushar3q34@gmail.com>
2025-05-23 13:03:46 +00:00
NOT XVilka
2e8f1f74ea
Update capstone to the latest next (#5145)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2025-05-12 03:52:38 +08:00
Giovanni
0fce23225b
subprojects: bump blake3 to 2de3cb1 (#5091) 2025-04-18 23:13:12 +08:00
NOT XVilka
0f032648f0
Update Rizin C grammar to tree-sitter-0.25.3 (#5088)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2025-04-16 23:42:11 +08:00
Giovanni
edbd019943 Update capstone-v6 to 6.0.0-Alpha4 (#5085) 2025-04-14 23:22:12 +04:00
Giovanni
d04dc5f586
Bump capstone to 21178aea90ec63c0be1e93c104a88fd20399d387 (#5064) 2025-04-07 17:54:32 +08:00
NOT XVilka
52cadeeb5f
subprojects: update xz to 5.8.1 (#5067)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2025-04-05 12:30:58 +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
Khairul Azhar Kasmiran
84c7d84d58
Prevent installation of libzstd.pc (#5008) 2025-03-18 00:39:59 +08:00
Rot127
1b50a5b954
librz/core: remove old shell completely (#5004)
* Fix UB access of NULL context.

During the tests the global RzCons is accessed. Because it was
never initialized all members were 0.
Leading to undefined behavior and breaking the test with ASAN enabled.

* Use correct yaml example for the command described.

* Remove old shell compatibility code.

* Remove dependency tree of rz_core_cmd_subst() and rz_core_cmd_subst_i().

* Remove rz_core_cmd_pipe_old()

* Remove unused rz_core_hack_help()

* Regenerate grammar after removal of legacy_quoted_stmt.
2025-03-17 22:26:22 +08:00
Anton Kochkov
929f582148 subprojects: regenerate shell grammar with 0.25.3 2025-03-07 09:45:07 +00:00
Anton Kochkov
d253d24d07 subprojects: update tree-sitter 2025-03-07 09:45:07 +00:00
NOT XVilka
495a79bfaf
subprojects: update lz4, xz, zstd libraries (#4958)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2025-03-04 02:44:53 +08:00
Anton Kochkov
c8e653fbc1
subprojects: update libzip from 1.9.2 to 1.11.3 (#3667) 2025-03-01 15:25:09 +08:00
Giovanni
d8a5fcf5c5
Bump capstone to 9affd99bcd20a6a0a61f36fed664a96023a7f51a (#4944) 2025-02-27 22:48:03 +08:00
Rot127
309f57434d
PCRE2 10.45 update. (#4889)
* PCRE2 10.45 update.
* Clone with depth 2 to get SLJIT project.
2025-02-11 02:00:50 +08:00
Rot127
d61b1c95e8
Bump Capstone version to newest next. (#4869) 2025-01-30 00:23:39 +08:00
Rot127
8d391b7b38
Bump Capstone v6 to Alpha3 (#4867) 2025-01-29 11:22:29 +08:00
Khairul Azhar Kasmiran
cf6488f943
grammar: Remove prec.right from tmp_*_op rules (#4846) 2025-01-17 20:40:16 +08:00
Khairul Azhar Kasmiran
380a94d619
grammar: Rename tmp_*_stmt to tmp_*_op (#4837)
* Rename `_tmp_stmt` to `_tmp_op`
* Rename `tmp_*_stmt` to `tmp_*_op`
* Update comment
* cautocmpl.c: `"_stmt"` -> `"_op"`
2025-01-14 23:05:22 +08:00
Khairul Azhar Kasmiran
79814e46b6
Fix #4799: Use Meson to set c_std=c99 (#4828)
* Fix #4799: Use Meson to set `c_std=c99`
* Define `_GNU_SOURCE`
* Use alt syntax in float subtraction
2025-01-13 22:22:23 +08:00
Khairul Azhar Kasmiran
1fafca62af
Fix #4816: Apply @ temp operators from left to right (#4826) 2025-01-08 20:14:18 +08:00
Giovanni
14eeccea70
Update capstone next to use CS_OPT_SYNTAX_NO_DOLLAR on loongarch (#4827) 2025-01-07 09:50:57 +08:00
Giovanni
b019d9d4ca
Add initial support to loongarch 32/64 (#4810) 2025-01-01 15:36:23 +08:00
Anton Kochkov
2d0030e847
subprojects: update rz-libdemangle (#4791) 2024-12-23 22:03:15 +08:00
Rot127
21fda95684
Bump Capstone to newest next (#4758)
* Fix check for rfe, operand is now an memory operand.
* Use ARM features upper case identifiers.
* Bump Capstone to newest next.
* Fix trivial tests
2024-12-19 00:08:14 +08:00
Khairul Azhar Kasmiran
3556a7ea04
Remove -Wno-deprecated-non-prototype from macos build (#4728) 2024-11-22 21:28:16 +08:00