No description
Find a file
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
.builds Run tests in OpenBSD with doas. (#5234) 2025-07-05 18:44:13 +08:00
.github Bump actions/setup-python from 5 to 6 (#5350) 2025-09-11 21:28:44 +08:00
.reuse Fix license linter 2024-03-07 18:38:49 +08:00
.woodpecker Run tests on woodpecker but be verbose. 2024-09-23 14:24:41 +08:00
binrz Add I=RzIL to rz-asm -L help (#5341) 2025-09-06 17:49:36 +08:00
dist Drop libuv dependency 2022-08-06 13:20:52 +02:00
doc doc/fortunes: fix incorrect hash calculation command (#5297) 2025-08-13 08:22:38 +08:00
librz Improve performance of string search. (#5262) 2025-09-11 22:29:20 +08:00
LICENSES Move SDB into RzUtil 2022-07-19 08:45:20 +02:00
subprojects Improve performance of string search. (#5262) 2025-09-11 22:29:20 +08:00
sys Re-format Python files according to black v25. (#4921) 2025-02-22 03:01:14 +08:00
test Improve performance of string search. (#5262) 2025-09-11 22:29:20 +08:00
.appveyor.yml ci: install tomli for meson (#4590) 2024-08-15 20:43:00 +08:00
.clang-format refactor: Use HtSP for storing plugins. (#4687) 2024-10-26 16:31:13 +08:00
.dockerignore Drop libuv dependency 2022-08-06 13:20:52 +02:00
.gitattributes Move remaining things from shlr/ to meson subprojects (#2126) 2021-12-22 09:20:39 +08:00
.gitignore Add rz-libswift as dependency and disable globally use_swift_demangler (#5298) 2025-08-16 00:03:55 +08:00
.lgtm.yml
.prettierignore Move remaining things from shlr/ to meson subprojects (#2126) 2021-12-22 09:20:39 +08:00
.pylintrc Redirect stderr to stdout via -1; Unbreak dk 9 test (#4664) 2024-10-12 06:37:09 +08:00
.travis.yml ci: install tomli for meson (#4590) 2024-08-15 20:43:00 +08:00
BUILDING.md Add guide how to generate test coverage reports. (#5289) 2025-08-01 10:55:37 +00:00
CODE_OF_CONDUCT.md
codecov.yml Add the Qualcomm Peripheral Image loader (MDT files, 32bit only). 2025-06-11 15:41:03 +00:00
CODEOWNERS Add myself as code owner to be added as default reviewer to PRs. (#4839) 2025-01-15 22:29:13 +08:00
CONTRIBUTING.md CONTRIBUTING.md: Remove commit hashtag requirement (#4186) 2024-02-05 18:39:37 +08:00
COPYING
COPYING.LESSER
DEVELOPERS.md util: implement iterator for hash tables and sets (#4639) 2024-09-24 21:36:54 +08:00
Dockerfile docker: update to Debian 11 (Bullseye) (#5277) 2025-07-18 12:27:28 +08:00
Doxyfile Move remaining things from shlr/ to meson subprojects (#2126) 2021-12-22 09:20:39 +08:00
meson.build Add: Mark API (#5313) 2025-09-01 22:06:01 +00:00
meson_options.txt Add rz-libswift as dependency and disable globally use_swift_demangler (#5298) 2025-08-16 00:03:55 +08:00
README.md Update README.md (#4915) 2025-02-19 01:06:44 +08:00
SECURITY.md Update Security policy to be more precise about vulns 2021-08-25 13:13:37 +02:00
snapcraft.yaml Bump version to v0.9.0 2025-04-23 16:49:14 +08:00
travis-extract-var.sh SPDX Copyright text for all files based on history 2021-03-05 19:39:15 +08:00
travis-script Use meson setup <dir> instead of meson <dir> 2023-04-26 20:01:47 +08:00

Rizin logo

Rizin

Rizin is a reverse engineering framework, born as a fork of the radare2, with a focus on usability, features and cleanliness.

Rizin is portable and it can be used to analyze binaries, disassemble code, debug programs, as a forensic tool, as a scriptable command-line hexadecimal editor able to open disk files, and much more!

To learn more on Rizin you may want to read the official Rizin book.

How to install

Look at install instructions on our web page.

How to build

Use meson to compile and install Rizin. Please make sure to get an updated meson (e.g. get it with pip install meson if your system does not provide one that is at least version 0.55.0).

Clone this repository:

$ git clone https://github.com/rizinorg/rizin

Then compile and install with:

$ meson setup build
$ meson compile -C build
$ sudo meson install -C build

Now you can use rizin:

$ rizin
 -- Thank you for using rizin. Have a nice night!
[0x00000000]>

To uninstall rizin, execute sudo ninja -C build uninstall.

Please have a look at BUILDING.md for more information about building Rizin.

Contributing

We very much welcome any kind of contributions, from typos, to documentation, to refactoring, up to completely new features you may think of. Before contributing, we would like you to read the file CONTRIBUTING.md, so that we can all be on the same page.

Tests

Look at test/README.md.

Supported features

Supported Operating Systems

Windows 7 and higher, Apple macOS/iOS/iPadOS, GNU/Linux, [Dragonfly|Net|Free|Open]BSD, Android, QNX, Solaris/Illumos, Haiku, GNU/Darwin, GNU/Hurd.

Supported Architectures

i386, x86-64, ARM/ARM64, RISC-V, PowerPC, MIPS, AVR, SPARC, System Z (S390), SuperH, m68k, m680x, XAP, XCore, CR16, HPPA, ARC, Blackfin, Z80, H8/300, Renesas (V810, V850, RL78), CRIS, XAP, PIC, LM32, 8051, 6502, i4004, i8080, Propeller, Tricore, CHIP-8, LH5801, T8200, GameBoy, SNES, SPC700, MSP430, Xtensa, NIOS II, TMS320 (c54x, c55x, c55+, c64x), Hexagon, DCPU16, LANAI, MCORE, mcs96, RSP, C-SKY(MCore), VAX, AMD Am29000.

There is also support for the following bytecode formats:

Dalvik, EBC, Java, Lua, Python, WebAssembly, Brainfuck, Malbolge

Supported File Formats

ELF, Mach-O, Fatmach-O, PE, PE+, MZ, COFF, OMF, NE, LE, LX, TE, XBE, BIOS/UEFI, Dyldcache, DEX, ART, CGC, ELF, Java class, Android boot image, Plan9 executable, ZIMG, MBN/SBL bootloader, ELF coredump, MDMP (Windows minidump), DMP (Windows pagedump), WASM (WebAssembly binary), Commodore VICE emulator, QNX, Game Boy (Advance), Nintendo DS ROMs and Nintendo 3DS FIRMs.

Tools

Apart from the main tool rizin, there are also other tools tailored for specific purposes and useful for shell scripting or as separate standalone tools:

  • rz-bin - provides all kind of information about binary formats
  • rz-asm - a command-line assembler and disassemblers
  • rz-diff - a tool to compare two binaries as raw data or analyzed executables
  • rz-hash - allows to calculate different hashes or even encrypt data
  • rz-gg - a small "eggs" code generator useful for exploitation purposes
  • rz-find - binary analog of find tool, allowing to search patterns and bit masks
  • rz-sign - tool to create, convert and parse FLIRT signatures
  • rz-ax - a calculator and number format converter
  • rz-run - a tool that allows to specify running environment and arguments for debugged file

Scripting

We provide a way to interact with Rizin from Python, Haskell, OCaml, Ruby, Rust, and Go languages through rzpipe. Other languages although not currently supported could be easily added.

Community

Our website and blog: https://www.rizin.re/

Join our Mattermost community to discuss Rizin, its development, and general topics related to the project.

We also provide the following partial bridges to other messaging platforms: