30818 Commits
Author SHA1 Message Date
Anton Kochkov ca2f24aebb Rewrite the Doxygen configuration to only carry non-defaults 2026-09-06 10:23:06 +08:00
NOT XVilkaandAnton Kochkov 19d583b34f librz/util/strbuf: append a signed number in hex (#6703)
Co-authored-by: Anton Kochkov <[email protected]>
2026-09-06 10:21:08 +08:00
billow 7381fae172 Update capstone-next to 95c74d3d (#6698) 2026-09-04 19:28:45 +08:00
Rot127 f5c902a5b6 Bump PCRE2 to 10.48 (#6692) 2026-09-03 14:29:29 +00:00
wargio f6e3cceb8d Implement rz_sys_getenv_as_[unsigned|bool] for public use 2026-09-03 09:04:19 +01:00
wargio 16450944a4 Add support for RZ_COLOR in rz-find 2026-09-03 09:04:19 +01:00
wargio b138083171 Disable limit on max region size for string search 2026-09-03 09:04:19 +01:00
wargio be3f7e767a Allow to force search in files as pure raw buffers. 2026-09-03 09:04:19 +01:00
wargio 2760875919 Allow to disable colors when using -X 2026-09-03 09:04:19 +01:00
Rot127 c4f9b4245e Remove duplicate abl test and cover ablj in another test. (#6693) 2026-09-02 18:11:05 +00:00
Jagath P 053af05c43 APIs for adding null values to RzStructuredData (#6689)
* Adds APIs to insert NULL values to RzStructuredData
* Adds unit tests for APIs inserting null values to RzStructuredData
2026-08-31 09:05:09 +01:00
Rot127 192b771e1d Fix aar ignoring vmap memory. (#6664)
That fixes a really annoying bug of aar ignoring any vmap.
If core_search_for_xrefs_in_boundaries() gets an interval which lies within a vmap,
rz_io_size() returns the size equivalent mmap.
Which can be smaller and make the if case fails.

This seems to be a bug for all virtual files mapped in memory.
If a virtual file of size 0x100 is mapped to a memory map of
size 0x180, it creates a vmap of 0x100 for the file content and
a 0x80 mmap for the empty bytes.
These maps are names vmap.filename, mmap.filename.

rz_io_size() now seems to only ever return the size of the mmap.
I don't know why it does that.
And because it is one of the stone age functions I am not going down there to look.

This bug breaks aar for Qualcomm split firmware images (.mdt).
Removing this check should not have an impact, because I added
a check for the memory read.
2026-08-29 17:49:22 +00:00
billow 73b070d397 Update libdemangle to revision 4a0af689 (#6690)
Co-authored-by agent: root/GPT-5
2026-08-29 17:21:04 +00:00
Florian Märkl 26362e8c18 Fix sdb memory usage in RzBinFile/RzBinObject (Fix #6688) (#6691)
This fixes several interdependent issues, originally surfaced as leaked
memory by xzy test cases:

- Fixed double-free of sub-namespaced sdbs in ns_free_exc_list and added
  a test for this case. Refcounting should correctly account for the
  amount of times an sdb is referenced as a sub-namespace.

This caused even more leaks, whose causes are now localized downstream:

- bf->sdb->refs++; in rz_bin_object_new() appears to have only been a
  workaround for the actual issue mentioned above.
- RzBinObject.kv also depended on it, but actually it is supposed to
  only be an additional reference to an sdb managed by the plugin, so we
  adjust the code accordingly.

Finally, test_rz_bin_reloc_storage also had an independent leak fixed
here to make the entire test file leak-free.
2026-08-29 09:24:13 +02:00
Suk Eunho 91202d4054 librz/bin: check allocation results and release a buffer on an error path (#6684) 2026-08-26 22:23:07 +01:00
fly1d de029d6f37 Fix script lookup for filenames with spaces (#6681) 2026-08-26 22:22:25 +01:00
MrQuantum1915 31632b51bc Fix use after free (#6685) 2026-08-26 19:22:03 +01:00
Ron Stephen Mathew ad0b76ac01 librz/diff: new API: rz_unified_diff_grouped() and rz_diff_op_stringify() (#6614) 2026-08-24 01:21:32 +08:00
Anton Kochkov 38c3bed6c9 librz/arch/tms320/c5x: classify BSAR as a right shift in analysis
BSAR (Barrel Shift ACC Right) was grouped with the left-shift ops and
reported RZ_ANALYSIS_OP_TYPE_SHL. It shifts the accumulator right (1..16
bits, sign-extended under SXM), so it belongs with the SHR group next to
RORB/SFRB. The decode (shift code + 1) was already correct and continues
to match the reference disassembler bit-for-bit.
2026-08-17 01:53:33 +08:00
Anton Kochkov ad462e7ede librz/arch/tms320: add TMS320C5x RzIL lifter
Lift the TMS320C5x instruction set to RzIL. Shared-semantics
instructions reuse the C2x lifter (the C5x-only forms that are a renamed
C2x op, such as the delayed branches, map onto their non-delayed
equivalents); the C5x-only core instructions (the ACCB accumulator-buffer
loads and logical ops, the swap, the zero-accumulator forms, the control
bits and the store-long-immediate) are lifted directly. Instructions with
effects the per-instruction RzIL cannot model cleanly (conditional
control transfers, block moves, parallel-logic, memory-mapped register
access, the MAC fetch forms) are decoded and analysed but left without
IL. Wired into the analysis plugin's il_config under cpu "c5x", with the
C5x register bindings (ACCB and the C5x-specific registers). The asm
tests assert the lifted RzIL, with execution tests covering the IL VM.
2026-08-17 01:53:33 +08:00
Anton Kochkov 79bec39195 librz/arch/tms320: add TMS320C2x RzIL lifter
Lift the TMS320C2x instruction set to RzIL: the 32-bit accumulator and
product paths, the auxiliary-register file with all indirect addressing
modes, the status bits (carry, overflow, OVM saturation, SXM sign
extension, product-mode shifts, TC), and the load/store, multiply,
accumulate, shift, logical and control-flow instructions. Wired into the
analysis plugin's il_config under cpu "c2x". The asm tests now assert the
lifted RzIL for every instruction, with execution tests covering the IL
VM end to end.
2026-08-17 01:53:33 +08:00
Anton Kochkov 148b54a9fc librz/arch/tms320: add TMS320C5x disassembler and analysis
Add the real TMS320C5x (C50/C51/C53) object encoding. The C5x is
source-compatible with the C2x but encodes instructions differently, so
it cannot reuse the C2x decode table: a dedicated C5x decode front-end
fills the shared C55 instruction representation, carrying the C2x ids for
shared-semantics instructions (so the common consumers apply unchanged)
and new C5x-only ids for the C5x additions (ACCB ops, parallel-logic,
memory-mapped register access, conditional execute/call/return, block
moves, ...). Wired into the tms320 asm and analysis plugins under cpu
"c5x", with the C5x mnemonic and op-type tables and register profile.
Includes disassembly and opcode classification tests.
2026-08-17 01:53:33 +08:00
Anton Kochkov 7b36a031ca librz/arch/tms320: add TMS320C2x disassembler and analysis
Add support for the legacy TMS320C2x (C25-class) fixed-point DSP family
to the shared C55 decode-IR engine: the C2x opcode table, operand
extractors, mnemonic and op-type tables, and the register profile, wired
into the tms320 asm and analysis plugins under cpu "c2x". The decoder
fills the shared C55 instruction representation so the common formatter
and analysis filler apply unchanged. Includes disassembly and opcode
classification tests, plus a COFF-loading test exercising the new bin
autodetect.
2026-08-17 01:53:33 +08:00
Anton Kochkov 68471f8736 librz/bin: autodetect legacy TMS320C1x/C2x/C5x COFF objects
The legacy TMS320 fixed-point families ship as 16-bit big-endian COFF
objects whose magic and machine identifiers were not recognised by the
COFF loader. Teach the COFF format backend and the bin plugin to detect
and load them so the new tms320 c2x/c5x analysis can operate on real
object files.
2026-08-17 01:53:33 +08:00
Anton Kochkov fee84c7f5c librz/bin/coff: scale addresses on word-addressed TI targets
The C54x and C28x address 16-bit words, so their loadable section sizes
and every address in the file count words. Rizin's address space is
byte-based, so reading those unscaled mapped only half of each loadable
section and placed every symbol at half its true offset: _main in the
c54x emulateme object landed mid-instruction instead of on its prologue.

Scale section VAs, loadable section sizes and symbol addresses by the
target's address unit. Debug sections are byte streams even on these
targets and keep a scale of one, matching the loadable mask already used
for mapping. The C55x addresses program memory by byte and is left
alone; the ids were checked against the objects in rizin-testbins by
comparing each section's declared size against its extent in the file.

Branch and call targets on the C54x count program words too, and reached
analysis and RzIL unscaled. That went unnoticed while the sections were
half-mapped: the emulateme RzIL test ran from a mid-instruction address
whose decode happened to lift, so it pinned values produced by garbage.
Scale those as well and drive the test the way its C55x sibling does,
decrypting seckrit with the real key.

With the sections fully mapped, analysis now finds every routine the
c54x fixtures declare, so the function counts change.
2026-08-17 01:53:33 +08:00
billow f82d6e2104 Fix CID 912643: Overflowed constant (INTEGER_OVERFLOW) (#6667)
Guard infinity encoding against invalid formats
2026-08-15 11:46:58 +08:00
SSharshunov 5e0afe5402 [c166] Fix CIDs (overflows) (#6599)
CID 911455

CID 911454

CID 909873
2026-08-12 12:04:56 +00:00
Rot127 38d0a78e36 Add example to change the search prefix temporarily. (#6662) 2026-08-12 09:24:25 +00:00
billow 19b1783c88 Improve RzIL floating-point support (#6626)
The `RzFloat` changes fix or improve:

- binary80 explicit-integer-bit, pseudo-value, infinity, and NaN handling;
- binary16 conversions;
- gradual underflow and directed rounding;
- overflow, underflow, invalid-operation, and inexact exception reporting;
- exception propagation through nested conversions and arithmetic operations;
- binary80 fused multiply-add rounding, including reduced-precision and double-rounding edge cases;
- thread-local SoftFloat state, preventing rounding state from leaking between threads.

The `RzIL` changes add scoped binary80 precision support through `RzFloatRPrecision` and `FWITH_RPREC`. The supported precisions are 32, 64, and 80. Precision scopes restore the
previous thread-local SoftFloat state after successful evaluation and evaluation failures.

Runtime rounding modes are represented explicitly by dedicated pure opcodes:

- `FCONVERT_WITH_RMODE`
- `FROUND_WITH_RMODE`
- `FSQRT_WITH_RMODE`
- `FADD_WITH_RMODE`
- `FSUB_WITH_RMODE`
- `FMUL_WITH_RMODE`
- `FDIV_WITH_RMODE`
- `FMOD_WITH_RMODE`

Their rounding-mode operand is a 32-bit IL bitvector whose values correspond to `RzFloatRMode`: RNE, RNA, RTP, RTN, and RTZ. Invalid operand widths are rejected by validation,
while invalid runtime values cause evaluation to fail with an error.

Dedicated opcodes keep runtime-controlled floating-point expressions compact. This is useful for architectures whose rounding mode is selected from register state and avoids the
expression duplication caused by expanding every operation into nested `ITE` branches.

The new operations are supported by:

- construction, duplication, and destruction;
- type and operand validation;
- VM evaluation;
- plain, Unicode, and JSON exporters;
- graph output and opcode stringification.

`FEXCEPT` now emits a VM event only when the queried exception is present, while preserving exceptions raised by nested conversions and arithmetic operations.
2026-08-10 01:06:17 +08:00
Thiago MucciandRot127 e33674578c util/ht: add key-value pair iterator support (#6483)
---------

Co-authored-by: Rot127 <[email protected]>
2026-08-05 20:33:05 +00:00
Rot127 6f264e7019 Improve default behavior of string search (NUL = new line) (#6573)
* Allow to set dotall and multiline flag also for normal regex patterns.

* String search sees NUL as newline by default.

That is the most intuitive option for binary searches.
The behavior can still be changed. An example us added.
2026-08-05 17:18:11 +00:00
Rot127 e8818d1888 Bump Capstone v6 to Alpha10 (#6644)
* Bump Capstone v6 to Alpha10

* Bump capstone-next to latest commit.

* Remove Alpha check for upper case enums.

* Add Xtensa ESP32s3 CPU.

Moves the asm tests to a properly configured test file.

* Document db/asm file naming

* Fix leaks
2026-08-04 13:00:50 +00:00
Florian Märkl 136a337e1c Set rizin version to 0.10.0 (#6656)
1.0 does not automatically follow after 0.9
2026-08-02 20:38:57 +02:00
Ron Stephen Mathew 79a3b8c41f Rz cons html filter bright foreground background and resets. (#6606) 2026-08-02 09:26:29 +08:00
Khairul Azhar Kasmiran bceffc3e9f Fix missing "RUN" in db/rzil/x86 (#6652) 2026-08-01 10:27:02 +08:00
مصطفي محمود كمال الدين cd413986ac fix zimg to have sections (#6653) 2026-08-01 10:26:36 +08:00
Arya H RandArya-1-HR 2e834543d6 librz/arch/lua: reduced heap allocations during LuaJIT processing (#6596)
Co-authored-by: Arya-1-HR <[email protected]>
2026-07-31 02:49:01 +08:00
Naren Sirigere c85a1fdde7 librz/arch: fix M680x instruction mappings (#6609)
* Fix M680x instruction mappings
* Make the CPU mode checks case insensitive
* Share CPU mode selection
2026-07-31 02:47:50 +08:00
Florian Märkl f051e7ba29 Avoid 0-size realloc in RzVector (#6642)
realloc with 0 size behavior is implementation-defined and not very
useful to us, also valgrind is noisy about it.
When we shrink with len 0, it is best to just free the array.
2026-07-29 20:29:28 +02:00
Rot127 f05d8e228b Fix call flag in CFG json output. (#6639) 2026-07-29 14:54:41 +00:00
Florian Märkl 60514e78f9 Allow 1-sized ring buffer (#6641)
This is legal too and sometimes useful, for example when the ring buffer
is used to send single messages rather than a using it as a queue.
2026-07-29 08:53:09 +02:00
Rot127 dd618bb30a Hexagon fix for abstract interpretation overestimation of jump targets (#6634)
The jump addresses of call and jump instructions are now written to their own
and unique local variables. Before this, all jump instructions wrote to the
same local variable.

This was a problem for abstract interpretation: Because if multiple writes to
the same local var happen due to a previous TOP condition, the local variable
content is also TOP. If the jump target is TOP, the interpreter can't follow it
anymore.

Added tests for all the funny packet configurations with 0-2 jumps in it.
2026-07-27 22:50:13 +02:00
MrQuantum1915 d20f27aef3 librz/util: RzTrie (prefix tree) implementation (#6638)
* Prefix Tree (Trie)
* Implemented complete RzTrie library, for prefix trees with all major APIs and full unit testing.
* Two unit tests: one for string and one for bitvector (to show usage). Almost 100% coverage
2026-07-28 02:09:09 +08:00
NOT XVilkaandAnton Kochkov 04c759086c Fix memory leaks in the dmi command's module lookup (#6598)
Co-authored-by: Anton Kochkov <[email protected]>
2026-07-26 02:28:18 +08:00
Anton Kochkov f5bb3a9a41 rz-util: skip the expression parser for bare integer literals 2026-07-26 00:00:50 +08:00
Anton Kochkov 78b903c5f7 rz-debug: stop reporting an error per instruction for unprofiled registers
rz_debug_trace_ins_after() runs for every instruction while a debug session
records, and logged an error whenever the disassembler named a register
that is not in the debug register profile. x86-64 has no zmm or k entries,
so on a CPU where glibc selects the EVEX string routines every vector
instruction produced a line on stderr. In a `dc` under `dts+`, which single
-steps, that is one line per executed instruction; rz-test buffers all of
it, and the write cost alone can push a test over its timeout.

Demote it to a debug message and name the instruction address, so the same
information is available when it is wanted without being paid for on every
step.
2026-07-26 00:00:50 +08:00
Anton Kochkov fdd99cf452 rz-debug: record memory writes wider than 32 bytes
rz_debug_trace_ins_before() dropped any memory write larger than 32 bytes
because rz_debug_trace_ins_after() read it into a fixed 32-byte stack
buffer. The write was then missing from the session, so stepping or
continuing back over it restored stale memory without saying so.

On x86-64 this fires on ordinary code: the glibc PLT and IFUNC resolvers
save vector state with XSAVE, which is a 576 byte write for the legacy
region plus header and more once AVX-512 state is enabled. Size the buffer
to the access instead, cap it at 4096 bytes, and warn with the address when
something exceeds that so the gap in the recording is visible.
2026-07-26 00:00:50 +08:00
Anton Kochkov a41fc7f197 Install missing rz_num_expressions.h header 2026-07-24 10:36:25 +02:00
Anton Kochkov 0d362aab25 test: do not pin a libm pow() result to full precision
% 2**4.5 asserted both the %.17g rendering and the exact bit pattern of
pow(2.0, 4.5). The exact value is 22.62741699796952078...; glibc and the
UCRT return the correctly rounded 0x4036a09e667f3bcd, while FreeBSD and
NetBSD return 0x4036a09e667f3bcc, one ULP low. msun's pow is documented as
under one ULP, not correctly rounded, so the test asserted bit-exact libm
behaviour for a transcendental and could not pass everywhere.

Filter the output down to the rounded line, which every implementation
within one ULP agrees on. The full float/scifmt/hex table stays covered by
the tests whose results are exactly representable.
2026-07-24 10:36:25 +02:00
Anton Kochkov 842cde6138 rz-debug: terminate the map start token on NetBSD, OpenBSD and DragonFly
rz_debug_native_map_get() splits a "<start>-<end>" region by copying the
tail into region2, but never terminated region at the '-'. That was
harmless while rz_num_get() stopped at the first character it could not
read; it no longer does, so the start token is now evaluated as a whole
expression:

    0x7fc8124c4000-7fc81278d000  ->  syntax error, 0
    0x400000-0405000             ->  0x3df600, the end read as C octal

Every map then gets a wrong start address. linux_map_get() was fixed when
the parser changed; these three copies were missed. kfbsd.c reads the two
bounds as separate sscanf fields and is unaffected, as is the FreeBSD
map_get, which does not parse text at all.
2026-07-24 10:36:25 +02:00