Commit graph

30477 commits

Author SHA1 Message Date
Florian Märkl
7e97635726
Avoid overlapping memcpy in rz_vector_sort() (#6411)
Detected with valgrind, some element assignments could memcpy with
identical addresses. This is usually a no-op in practice, but
theoretically undefined behavior.
2026-05-28 06:33:45 +02:00
NOT XVilka
9960ae3bed
test/bench: add benchmark for RzDiff (#6398)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-05-27 18:36:58 +08:00
Khairul Azhar Kasmiran
1abe2dce99
Prevent RzBuffer's Oxff_priv from overriding io.0xff (#6371)
* Prevent RzBuffer's `Oxff_priv` from overriding `io.0xff`
* Use io from RZ_BUFFER_IO and RZ_BUFFER_IO_FD buffers
* Add `RzIO *` param to rz_buf_new_mmap()
* pe: Discard incomplete import directory
2026-05-27 06:18:45 +08:00
Rot127
c6820479c6
test/bench: add geometric stats to benchmarks (#6403)
* Add option to replace (geometric) invalid values with another value.
* Add geometric Mean and Std Dev to benchmarks.
* Add Doxygen documentation
* Add a README to the bench dir as intro.
2026-05-26 16:15:02 +08:00
Florian Märkl
0b74a61fe4
Install missing rz_math.h header (#6401)
Added in 702250eb4f but not installed
2026-05-25 10:32:36 +02:00
Florian Märkl
a72a275ca2
Fix deadlock in rz_th_queue_close_when_empty() (#6383)
empty_cond was never signalled and the termination depended only on
the timeout in rz_th_queue_close_when_empty() causing a re-check of
emptiness.
However, the rz_th_cond_timed_wait() implementation, which was used
there, was flawed because it expected a relative timeout but passed that
directly to pthread_cond_timedwait() which expected an absolute time
value, practically causing it to time out immediately. Depending on the
pthread_cond implementation, this possibly created a situation where the
mutex could never be acquired by another thread, effectively causing a
deadlock. This behavior was observed on Mac OS X 10.5 (ppc) when running
the test_core_bin test.
We solve this by not using a timeout at all and signalling the condition
variable for all waiting threads at the appropriate time.
2026-05-25 09:25:29 +02:00
Rot127
702250eb4f
test/bench: measure standard deviation for benchmarks (#6390)
* Add Welfords square of sums algorithm for variance and std deviation calculations.
* Add standard deviation to benchmarks
* Simplify Welford
* Add geometric mean and standard deviation to Welford Sums
2026-05-25 05:08:06 +08:00
bubblepipe
6be10c2428
librz/core/analysis: fix data xref in K64F-RIOT-SPI.elf not marked properly (#6363) 2026-05-25 00:15:39 +08:00
MrQuantum1915
a54489190b
librz/core: implement ROP/JOP/COP gadget cache (#6328) 2026-05-24 21:48:42 +08:00
Khairul Azhar Kasmiran
60f39e2df5
librz/bin/pe: discard incomplete section headers (#6397)
* PE: discard incomplete section headers
* Invert logic
2026-05-24 01:11:43 +08:00
Rot127
12a16c812b
Add order ignoring remove_at version with better performance. (#6389)
* Add order ignoring remove_at version with better performance.

* Optimize rz_vector_swap by using stack memory for small elements.

* Add benchmark for rz_vector_swap
2026-05-22 20:54:49 +00:00
Rot127
75cd389b5c
Graph - API changes to enum (#6349)
* Refactor del_edges to use RzGraphStatus.

* Refactor del_edge() to use RzGraphStatus.

* Refactor update_edge() to use RzGraphStatus.

* Refactor has_edge() to use RzGraphStatus.

* Refactor add_edge() to use RzGraphStatus.

* Fix leak of b

* Fix leak of xref list

* Fix leaks of analysis ops

* Address review comments

* Inlcude clean up

* Fix invalid free

* Add tests with node and edge data.

* Extend tests
2026-05-22 13:45:18 +00:00
Florian Märkl
3526b09423
Fix unit tests on 32-bit platforms (#6384)
Various issues related to pointer size and RzVector behavior.
Testing rz_pvector_shrink() at the place removed here is not necessary
as it has its own dedicated tests.
2026-05-19 11:44:32 +08:00
Florian Märkl
65313b186c
Add rz_analysis_get_cpu() API and use it in plugins (#6353)
Now that the RzAnalysis struct is private, it is necessary to have this
API for plugins outside the rizin codebase.
2026-05-19 02:33:12 +08:00
Rot127
8a76ab1733
Bump demangler to latest commit + fix useless code (#6381)
* Update libdemangle to fix reachable double free
* Get some return on an energy burning loop.
2026-05-18 23:20:19 +08:00
SSharshunov
b2297073bf
librz/bin/omf166: fix format errors and if_fail macroses (PFMTSZu) (#6368) 2026-05-17 20:21:05 +08:00
MrQuantum1915
d25f2be0d2
shell/rop: highlight conditional gadgets in all modes (#6324) 2026-05-17 03:41:17 +08:00
MrQuantum1915
258b5ed989
Arange fields in descending order of size (#6360) 2026-05-16 23:12:58 +08:00
Giovanni
5e7fa12b5a
Add RzConfigValidator for validating (on set) owned variables (#6356) 2026-05-16 16:12:13 +02:00
SSharshunov
ee3e628c8a
librz/bin/omf166: fix format errors and if_fail macroses (#6362) 2026-05-16 21:06:31 +08:00
Rot127
1adba3227a
librz/util/graph: various improvements
* GRAPH: Add rz_graph_add_get_node() and refine API.
* GRAPH: Remove unused, and rename parameters.
* Improve doxygen.
* Implement rz_graph_del_edges()
* Rename rz_graph_node_get_hash_id() to rz_graph_node_get_hash_id() to make clear what identifier is returned.
* Simplify node identification.

Removes the option to have two sources of identifiers (node data or other identifier data).
Changes the API to use the hash id instead of a pointer to data.

* Fix type annotations.
* Remove duplicate function.
* Fix invalid asserts.
* Set flag if node was present.
* Grow by a factor of 1.25. Exponential growth quickly leads to OOM.
* Remove the edge index again to not remove reduce the main advantage of an adjacency matrix
* Refactor list based graph to use vectors instead of hash maps for edges.
* Fix heap-use-after-free
* Add an rz_graph_update_edge function.
* Add function to print graph as dot graph.
* Add warning about del_edges runtime.
* Refactor add_node to use RzGraphStatus.
* Refactor del_node to use RzGraphStatus.
* Use cast-macro to prevent ASAN issues.
2026-05-16 19:12:01 +08:00
Khairul Azhar Kasmiran
c969056558
Fix bb refcount when bb is overlength (#6358) 2026-05-16 13:02:26 +08:00
SSharshunov
5256726d00
librz/arch/c166: remove unnecessary use of assert macroses (#6345) 2026-05-15 23:53:27 +08:00
MrQuantum1915
e8708c62d5
librz/arch/arm: fix memory leaks of RzILOpBitVector (#6354) 2026-05-15 23:37:34 +08:00
Khairul Azhar Kasmiran
17fd3815c6
Use -1 with tiny test (#6352) 2026-05-15 18:00:11 +08:00
SSharshunov
e4976144c3
librz/bin/omf166: fix coverity issues (#6346)
* CID 909878
* CID 909868
* CID 909875
* CID 909860
2026-05-15 01:52:20 +08:00
Giovanni
b56a44d9f0
test/unit: remove WITH_GPL from DWARF C++ test (#6351) 2026-05-14 23:36:29 +08:00
well-mannered-goat
5dd20c43b5
librz/bin/elf: improve aarch64 relocs support (#6022) 2026-05-14 12:54:12 +08:00
Arya H R
9ce185e507
librz/arch/luajit: fix parsing on big-endian machines (#6350) 2026-05-14 12:53:19 +08:00
Giovanni
2d1cff75ee
librz/bin/elf: add some missing MIPS relocs (#6348)
* Add support to various MIPS reloc conversion.

R_MIPS_26, R_MIPS_HI16, R_MIPS_LO16, R_MIPS_GOT16, R_MIPS_PC16,
R_MIPS_CALL16, R_MIPS_64, R_MIPS_GOT_HI16, R_MIPS_GOT_LO16,
R_MIPS_CALL_HI16, R_MIPS_CALL_LO16, R_MIPS_REL16

* Fix test missing RUN at the end.
2026-05-14 00:52:59 +08:00
Khairul Azhar Kasmiran
263a4b1b49
Fix afb-* (#6347)
* Base test output
* Fix `afb-*`
2026-05-14 00:52:20 +08:00
SSharshunov
75ad6e9a51
librz/arch/c166: fix behavior on big-endian hosts 2026-05-13 04:28:29 +08:00
NOT XVilka
93eeefc399
librz/core: fix OMF debug type error (#6343)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-05-13 02:54:02 +08:00
NOT XVilka
9db62b03fa
librz/bin/omf: OMF166 fix error handling (#6342)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-05-13 00:47:50 +08:00
Rot127
1750cc27fc
librz/bin/omf: fix build warning (#6341) 2026-05-13 00:47:23 +08:00
Arya H R
b09bdf2242
librz/arch: add LuaJIT 2.1 bytecode support (#5961)
* Add LuaJIT binary loader
* Add LuaJIT analysis and disassembly plugin
* New CPU format `luajit` for luac plugin
2026-05-12 23:37:10 +08:00
SSharshunov
ea370203ed
Support Siemens/Infineon C16x microcontroller (#6321) 2026-05-12 21:17:37 +08:00
Rot127
598e4c0ce8
Use libdemangle commit with fixed CVE. (#6340) 2026-05-12 09:41:04 +08:00
Rot127
e6d0937c8a
Fix OOB read in OMF format plugin (#6336)
* Fix OOB read of section due to invalid bounds check.
* Move array offset to variable for readability.
2026-05-11 23:53:51 +08:00
Florian Märkl
478dfbf895
Reduce verbose error messages from unsupported native debugger (#6337)
init and fini are called on regular rizin start, even if not debugging.
These errors were distracting and not very meaningful there. They do
however make sense when executing any actual debug operation.
2026-05-11 23:48:18 +08:00
MrQuantum1915
b4f2c39167
Feature: JOP and COP support (#6257)
* Refactor handlers

* COP Support

* JOP support

* Fix RISCV gadget search test

* Remove redundant cop,jop test

* Add COP tests

* Add JOP tests

* Combine gadget_[rjc]op.c into gadget.c
2026-05-11 09:56:35 +00:00
Khairul Azhar Kasmiran
27f0be61fe
pdq: Downgrade "Failed to read chunk" msg from error to warning (#6332) 2026-05-11 15:31:17 +08:00
Rot127
045fff363b
Fix double free and reject invalid values for search.in (#6327) 2026-05-11 13:01:53 +08:00
Florian Märkl
f1251293a4 Patch zydis to work on OpenBSD/sparc64
This combines the following patches already sent upstream:
https://github.com/zyantific/zycore-c/pull/97
https://github.com/zyantific/zydis/pull/603

...and introduces a workaround to fix segfaults caused by accesses into
arrays of the packed ZydisShortString struct. The final solution will
likely be an upstream rework of this structure:
https://github.com/zyantific/zydis/issues/263

Finally, we adjust the condition for when ZydisStringAppendHexU32 is
used, since it is not defined by default. This is already solved more
elegantly in Zydis development upstream, but it requires more changes,
so we stick to a smaller patch on top of the latest release for now.
2026-05-11 11:54:02 +08:00
Florian Märkl
1cb5859f8e Apply patches/fix_zydis_amalgamated_riscv32_build to subproject
We already vendor a patched zydis and this fix should be available to
everyone, not only CI.
2026-05-11 11:54:02 +08:00
bubblepipe
22edb366ef
analysis: fix data in K64F-RIOT-SPI.elf not marked properly (#6331) 2026-05-11 02:39:48 +08:00
NOT XVilka
decf3ba29c
test: fix avr/c166 detection test on SystemZ (#6333) 2026-05-11 02:37:52 +08:00
Giovanni
ebc586a5e2
Improve mips args & prelude detection (#6320) 2026-05-10 22:32:23 +08:00
SSharshunov
df8d022ab8
test: fix avr/c166 test on big endian machine (#6329) 2026-05-10 21:40:53 +08:00
Michal Ambroz
d3a51fd7b0
Fix s390x build without debugger (#6316)
* Fix s390x build without debugger

From: Andreas Schneider <asn@cryptomilk.org>
Date: Wed, 23 Apr 2026 11:35:00 +0200
Subject: [PATCH] Fix s390x link error when debugger is disabled

When the debugger is disabled (-Ddebugger=false), debug_native.c is not
compiled, so rz_debug_get_tls() and rz_debug_native_threads() are never
defined. However, linux_heap_glibc.c (part of librz_core) calls both
functions unconditionally, causing a link failure on s390x.

Add stub implementations in debug.c guarded by #if !DEBUGGER so the
symbols are always present in librz_debug regardless of the debugger
option.

* Fix formatting

---------

Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
2026-05-10 18:55:47 +08:00