Commit graph

30691 commits

Author SHA1 Message Date
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 Mucci
e33674578c
util/ht: add key-value pair iterator support (#6483)
---------

Co-authored-by: Rot127 <45763064+Rot127@users.noreply.github.com>
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 R
2e834543d6
librz/arch/lua: reduced heap allocations during LuaJIT processing (#6596)
Co-authored-by: Arya-1-HR <aryagowda177@gmail.com>
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)
Some checks failed
Manpage lint / mandoc (push) Has been cancelled
Muon build / ubuntu-muon (push) Has been cancelled
Mixed linter and checks / licenses (push) Has been cancelled
Code scanning / build (CodeQL-cpp) (push) Has been cancelled
Code scanning / build (CodeQL-javascript) (push) Has been cancelled
Code scanning / build (CodeQL-python) (push) Has been cancelled
Mixed linter and checks / changes (push) Has been cancelled
TinyCC build / ubuntu-tcc-test (push) Has been cancelled
Mixed linter and checks / cmd_descs_yaml_check (push) Has been cancelled
Mixed linter and checks / bindgen-linter (push) Has been cancelled
Mixed linter and checks / clang-format (push) Has been cancelled
Mixed linter and checks / prettier (push) Has been cancelled
Mixed linter and checks / python (push) Has been cancelled
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 XVilka
04c759086c
Fix memory leaks in the dmi command's module lookup (#6598)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
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
NOT XVilka
18d414f7d6
ci: fix TinyCC job by refreshing APT repos (#6636)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-07-24 03:42:02 +08:00
Anton Kochkov
689bafb7a4
Rewrite the RzNum parser and calculator on tree-sitter (#4326)
Replace the hand-written parser in calc.c with a tree-sitter grammar
(subprojects/rizin-math-parser) and a typed evaluator. The old parser
could only ever produce a ut64 and folded anything it failed to read to
0, which left callers unable to tell a failed expression from one that
evaluated to zero.

Expressions now evaluate to an RzNumValue, a tagged union over ut64,
double, RzBitVector, arbitrary-precision integer and arbitrary-precision
decimal, carrying an RzNumError rather than signalling failure as 0.
Literals keep the width they were written with (5u8, 0xffu128, any width
from 1 to 65536), results that outgrow 64 bits promote to a big number on
their own, and a parse error, division by zero or unresolved identifier
reaches the caller.

rz_num_math() is deprecated. rz_num_math_ut64() keeps its exact behaviour
for callers that want a ut64, and rz_num_math_value() exposes the typed
result. rz_core_math() adds the RzCore-backed form used by the % command,
with rz_core_math_ut64() deprecated alongside it. rz-ax routes through the
typed API, so it prints values at full precision, reports errors on stderr
and exits non-zero. rz_il_lift_num() converts an expression to an
RzILOpPure, so a numeric argument can be lifted instead of pre-evaluated.

Legacy input still works: trailing base suffixes (101b, 35o, 212t), the
trailing-'h' hex form and the k/m/g scale suffixes are all accepted and
warn once, pointing at the 0b/0o/0t prefixes. doc/math.md documents the
language and doc/math-il-lift.md the lift; the grammar, the evaluator,
rz-ax and the % command are covered by unit and db tests.
2026-07-24 02:57:27 +08:00
Farhan Saiyed
fa2db74f86
Change rz_config variables to use Set instead of List (#6623)
* Update rz_config list variables to set variables

* Linking error fix

* Update rz_config_get_options in cautocmpl.c

* Update rz_config_get_options in core/tui/config.c

* Test fix

* Assertion error fix
2026-07-23 15:09:58 +00:00
Farhan Saiyed
78045e8fc6
Fix x-axis address overflow in histogram (#6563) 2026-07-23 15:06:28 +00:00
Florian Märkl
3a22989501
Replace self-jmp in SPARC RzIL (#6632)
To perform the effect in a delay slot, if the branch was not taken, the
IL, which is already lifted as part of the delay slot instruction, would
explicitly jump to itself again, to execute the effect as normal.
This would create erroneous loop edges in the cfg.
It is actually not necessary to perform this jmp since we already have
the lifted effect and can inline it.
2026-07-23 14:57:14 +02:00
Naren Sirigere
e49ce34306
Make rz_analysis_op_is_call() treat op->type 's as enum values rather than bit flags (#6631) 2026-07-23 17:06:42 +08:00
Anton Kochkov
cc06c1dedb
Use Muon for the TinyCC build job (#3345) 2026-07-22 01:23:21 +08:00
MrQuantum1915
6150ac78bc
Fix classification of xrefs as data xrefs(#6612)
While processing xrefs for marking them as data:

1. classify target using `xref_ref_kind` for data section too, previously it was only classified if target was in exec segment. Which caused false positive when the target was in non-exec section. Happens when the immediate value is small and it points in data section.

2. restrict data block from bleeding into other sections. Currently it correctly caps data block  at next "detected" function (or next data) but when the function is not detected yet (like in stripped bins) and the area onward from data ref is empty, the data block bleeds into other sections specifically executable section. This should never happen.
2026-07-21 14:43:58 +00:00
Florian Märkl
9b57c7a8ec
Add exclusions to config saving (#6629)
This will be used for future experimental options that are subject to
frequent change and should not pollute projects.
2026-07-21 13:03:05 +02:00
Dmitry Opokin
cd1ad98598
Enhance milstd1750 analysis (#6557) 2026-07-21 16:53:41 +08:00
مصطفي محمود كمال الدين
a3c844eb15 fix the kernel URL to point to snapshot archives instead of roling release server which is ephermal 2026-07-20 10:42:29 +00:00
Farhan Saiyed
12cf18e7b0
unicode version update (#6595) 2026-07-19 17:54:12 +08:00
Jagath P
1d0320367b
Capstone eBPF disassembly (#6611) 2026-07-19 17:51:24 +08:00
مصطفي محمود كمال الدين
faf4afc0e3
Implement file download from the remote machine in GDB protocol (#6576) 2026-07-18 14:49:31 +08:00
billow
ffacc9e08f
Update capstone-next and support Alpha instruction ID variants (#6621)
* Support Capstone Alpha instruction ID variants
* Update capstone-next to ae11e423
* Fix memory leaks in rz-asm
2026-07-17 00:53:43 +08:00
Naren Sirigere
d1df8bd45a Use shallow clone for CI 2026-07-16 15:44:02 +00:00
Florian Märkl
a57652ccc0
RzIL op definition refinements (#6622)
Many IL ops such as add, sub, mul, ... share the same operand structure,
but previously in the RzILOpPure.op union there was only dedicated
members per exact opcode. So for code where multiple opcodes with
identical structure were handled, one had to either pick one of the
matching RzILOpPure.op members at random or add a large switch that was
technically unnecessary.
For such cases, we now make the structural identity explicit by
introducing shared operand structures such as RzILOpArgsBinopBV, which
can be used for all opcodes that match it.
Dedicated per-opcode typedefs and union members remain for when only a
single opcode is considered.
2026-07-16 14:22:47 +02:00
Farhan Saiyed
4d7ca4161a
Add pgup pgdown scrolling in histogram (#6535) 2026-07-15 22:52:58 +08:00
Giovanni
5349d34dcb
When sm3 on openssl is not available, compile algorithms/sm3/sm3.c (#6615) 2026-07-15 22:50:41 +08:00
Florian Märkl
1c4bcf6ef7
Fix and test lm32 disasm and replace unsafe string handling (#6620)
Tests are added for covering all edited lines and bugs fixed that were
discovered from these tests.
2026-07-14 16:12:32 +02:00
Khairul Azhar Kasmiran
5d699e8feb
Allow seek to flag realnames (#6593)
Flags are sorted into the name hashtable with their realnames as well.
Refcounting is used to prevent double-free and similar issues that would
be caused by this.
2026-07-14 16:12:05 +02:00
Florian Märkl
9836b05b05 Rewrite unsafe string handling in i8080 disasm 2026-07-13 19:44:09 +02:00
Florian Märkl
f762b37ca8 Replace sprintf usages in 8051 disassembly 2026-07-13 19:44:09 +02:00
Rot127
d2d6846e58 Speed up rz_bv_set_from functions 2026-07-12 09:35:08 +02:00
Florian Märkl
5353b06952 Replace unsafe string functions in gb plugins
None of these should be exploitable, but we want to get rid of these
unsafe functions.
2026-07-11 15:57:50 +02:00
Florian Märkl
a3c35a88a1 Remove rz_hex_from_js()
It is untested and segfaults in almost all cases. It is also not worth
fixing because the implementation of converting from base64 is not very
useful.
2026-07-11 15:57:50 +02:00
Florian Märkl
f430f28c02
Make rz_interval_tree_insert return the node (#6613)
There are APIs for which the node is needed, so it makes sense to return
it directly on insertion instead of only the boolean success state.
2026-07-11 14:08:35 +02:00