Commit graph

4645 commits

Author SHA1 Message Date
Florian Märkl
5353b06952 Replace unsafe string functions in gb plugins
Some checks failed
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
Mixed linter and checks / licenses (push) Has been cancelled
Muon build / ubuntu-muon (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
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
MrQuantum1915
de80709985
lbrz/core/cmd: fix config print for plugins (#6567) 2026-07-09 22:25:59 +08:00
Farhan Saiyed
d2859bbfdd
Update cconfig.c to make =? behave like =?? (#6546) 2026-07-09 09:58:26 +08:00
SSharshunov
eda5e12b56
librz/arch/c166: Coverity fixes
* CID: 909863
* CID: 909871
* CID: 909855
* CID: 909865
* CID: 909864
* CID: 909872
* CID: 909867
* CID: 909843
* CID: 909847
* CID: 909873
* CID 909856
2026-07-09 00:20:49 +08:00
wargio
c7dd1a9787 Fix behaviour of pb and ensure buffer is always smaller than block. 2026-07-07 23:14:47 +08:00
wargio
674cdbc25e Remove unused rz_str_word_get0set & rz_str_word_set0_stack 2026-07-07 23:14:47 +08:00
wargio
1dfba2cdb8 Harden rz_str_append to prevent sum overflow 2026-07-07 23:14:47 +08:00
wargio
cc07a214c1 Fix signed multiplication overflow 2026-07-07 23:14:47 +08:00
Giovanni
6f2989f0ad
Verify that EVP_sm3 is enabled. (#6605) 2026-07-06 18:27:24 +08:00
NOT XVilka
155ead6822
librz/reg: derive CC with more than four argument registers (#6600)
rz_reg_profile_to_cc() only emitted the first four argument registers
(A0-A3), so architectures that pass more arguments in registers -- the
C6000 EABI uses ten, and x86-64/riscv/ppc all declare more than four --
got a truncated convention. Walk the whole A0-A9 role range, stopping at
the first role the profile leaves undefined, and build the cc string with
RzStrBuf. Covered by a new test_reg unit test.

Co-authored-by agent: Claude/claude-opus-4-8

Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-07-06 03:35:41 +08:00
Khairul Azhar Kasmiran
4897885c5c
Uniquify function flag realnames (#6601) 2026-07-05 22:33:25 +08:00
NOT XVilka
6f630b785e
Fix memory leaks in bin, type parser, core meta and debug (#6594)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-07-05 02:56:19 +08:00
Naren Sirigere
3c02fa5618
Fix x64 and x86 SEH analysis (#6558) 2026-07-04 15:46:13 +08:00
NOT XVilka
84b2f31035
Fix memory leaks in arch and core (#6590)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-07-04 13:36:06 +08:00
Khairul Azhar Kasmiran
6249c2e5f2
Fix tn- <flag> (#6589) 2026-07-04 11:51:58 +08:00
Florian Märkl
ff4d6608c0
Add rz_bv_append_inplace() (#6592)
Warning: this also swaps the arguments of the old rz_bv_append() to be
consistend with the new inplace variant.
The reason why the inplace function has the low as the first operand is
that it can be more efficient to append to an existing vector inplace
than to prepend to it. Then, the first argument is being used as the
in-out one in all other inplace functions.
2026-07-03 23:31:30 +08:00
Naren Sirigere
22ce81d719
Fix Objective-C RTTI superclass decoding on big endian (#6588)
Fix Coverity issues: 910855, 910854
2026-07-03 10:40:33 +08:00
MrQuantum1915
893ff4e380
librz/util/pj: Fix JSON depth limit handling (#6533) 2026-07-02 15:21:36 +08:00
Khairul Azhar Kasmiran
90a2b56509
Fix tn- <hex_number> (#6585) 2026-07-02 11:11:28 +08:00
Naren Sirigere
6dbd1198c8
Recognize objc_msgSendSuper2 and objc rtti information (#6529) 2026-07-02 11:10:20 +08:00
NOT XVilka
ca07131f66
Fix memory leaks across arch, core, and util (#6581)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-07-02 11:10:03 +08:00
Sergey Fedorov
7bba522bb2
apple_ppc.c: restore forgotten header (#6583) 2026-07-01 19:35:33 +08:00
NOT XVilka
851ab98455
Fix memory leaks across core, bin, and PDB parsing (#6579)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-30 19:04:28 +08:00
NOT XVilka
402e0fc1b6
librz/bin: fix MTK image parsing on BE host (#6580)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-30 14:52:32 +08:00
Florian Märkl
1306a965ec
Split off RzAnalysisILContext from VM (Fix #6455) (#6574)
Information about the final register binding and memories is needed
independently of a stateful vm, specifically for analysis.
This is a pure refactor.
2026-06-29 13:45:05 +02:00
Naren Sirigere
478117db3b
Bump rz-libdemangle to get the dlang demangler (#6566)
Fix check_dlang() to check if the string starts with "_D" followed by any digit
2026-06-28 12:50:08 +08:00
Rot127
39ab034d28
Don't print meta items which are not at the current seek. (#6559)
* Don't print meta items which are not at the current seek.

The old code tried (unsuccessfully) to print _any_ meta item _covering_ the seek (ds->at).

There seems to be several bugs getting triggered with that.
One of them giving the behavior of https://github.com/rizinorg/rizin/issues/6556.

If the current seek is in a _data_ region, the disassembler logic doesn't care.
It just assumes that RzAsmOp.size is equivalent to the size of the objects there.
Even though there are only Meta items.

But since some meta items are like 4K bytes, RzAsmOp.size gets
trimmed down.
Anyways, that completely messes up the size calculation (as can be seen in the issue),
and the navigation.
I couldn't figure out where stuff broke.
But the library closes and I have to leave, so I push that.

That "fix" makes it at least behave somewhat consistently.

* Fix leaks

* Fix and add interactive test
2026-06-27 10:36:12 +00:00
Rot127
2478a95874
Fix performance for GOT offset lookup via a lookup table. (#6555) 2026-06-24 11:30:00 +08:00
Ashish Kumar
53e8999271
implement shake-128 and shake-256 (#6490) 2026-06-23 11:47:13 +08:00
Dmitry Opokin
9d37b7cdf2
Add MediaTek md1img and GFH firmware image parsers (#5974)
- Introduced md1img.h and md1img.c for parsing MediaTek md1img container format.
- Implemented mtk.h and mtk.c for parsing MediaTek GFH firmware images (md1rom).
- Added plugin support for md1img and mtk formats in bin_md1img.c and bin_mtk.c.
- Updated meson.build to include new source files and plugins.
- Enhanced RzBuffer utility with LZMA alone decompression support.

---------

Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
2026-06-22 20:25:48 +00:00
billow
bb3b7cc7b1
Add JSON projection grep (#6522) 2026-06-22 17:17:20 +00:00
Rot127
0599c98e76
Add hint for -F, if multiple bin plugins can load the binary. (#6548) 2026-06-22 11:24:46 +00:00
Rot127
da228d11cf
Add all call and other xrefs to the abl output (#6269)
* Ensure call targets are only added once for each block.
* Fix abl printing correct xrefs
2026-06-21 13:02:40 +08:00
مصطفي محمود كمال الدين
59d8c998e5 fix positive zero comparing inequal with negative zero, IEEE754 mandates equality 2026-06-21 03:48:49 +08:00
NOT XVilka
c351d5f32a
librz/cons: new "underwater" color theme (#6538)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-20 21:57:01 +08:00
NOT XVilka
06217cd05e
librz/type: fix forward type for enums (#6539)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-20 17:32:06 +08:00
NOT XVilka
2e8d857e63
Fix no-return function propagation (#6449)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-20 05:29:18 +08:00
NOT XVilka
37d11d985a
librz/arch/tms320: add support for the TMS320C54x series (#6534)
* arch/tms320: add TMS320C54x disassembly support

Add a C54x instruction decoder that reuses the shared C55x decode engine
(c55_decode/c55_format) via the C55ArchDesc plug-in interface, rather than
duplicating the matcher/formatter. Disassembly only for now (.lift = NULL).

Engine changes (c55_ir.c/.h):
 - add C55ArchDesc.words_le so the decoder can byte-swap the little-endian
   16-bit instruction words used by the C54x COFF object format;
 - add a self-contained C54x memory-operand renderer (direct @dma, MMR,
   indirect *ARx with all post-modify modes, *ARx(lk) const-index, *(lk)
   ABS16 absolute and circular '%' addressing) and bare-hex immediates;
 - add C55Operand.circular for the '%' suffix and C55Operand.space_join
   for the space-separated second half of a C54x parallel instruction;
 - extend the data-memory operand-field analysis (register, base pointer,
   displacement, direction, referenced size) to the LOAD/STORE op types the
   C54x ld/st family uses, in addition to the C55x MOV form.

The C54x decoder (isa/tms320/c54x/c54x.c) covers the complete documented
instruction set - all 117 mnemonics of the SPRU172 opcode map, in every
documented encoding form:
 - load/store/move, integer and logical ALU ops in every addressing form
   (Smem, #lk, dual-accumulator, Xmem/Ymem, TS/ASM/SHIFT-shifted, the
   shift-by-16 and #lk,16 long-immediate forms, and the two-word
   Smem,SHIFT form whose operation selector lives in the second word);
 - the full multiply/MAC family: Smem, #lk, program-memory, squaring,
   multiply-by-A, signed-unsigned and the dual-operand MAC[R]/MAS[R]
   Xmem,Ymem forms;
 - the parallel (dual-operation) class rendered "op1 .. || op2 .." -
   ST||ADD/SUB/LD/MPY/MAC[R]/MAS[R], ST||LD T and LD||MAC[R]/MAS[R];
 - double/long-word (Lmem) add/subtract, the unary accumulator ops
   (exp/norm/abs/neg/rnd/sat/min/max/rol/ror/sftc/cmpl/...);
 - control flow with the separate delayed (bd/calld/bcd/banzd/fcalad/...)
   variants, conditional return/execute (rc[d]/xc) and the multi-condition
   "tc, c"-style combinable condition fields, repeats (incl. rpt #lk),
   conditional stores, I/O port access, status-bit set/clear and the
   non-linear idle encoding.

Operands resolve to their architectural names - the full memory-mapped
register file (AR0-AR7, the accumulator AL/AH/AG/BL/BH/BG halves, T, TRN,
SP, BK, BRC/RSA/REA, IMR/IFR, PMST, XPC), the ST0/ST1 status bits and the
named condition codes; the memory-mapped-register operand is kept single
word (its long-offset modes are not legal). The analyzer classifies every
instruction (op->type, op->id), resolves branch/call targets and the stack
effect of calls/returns/pushes, and exposes operand details: the register,
base pointer, displacement and access direction of data-memory loads and
stores, and the target register of indirect branches/calls.

All encodings were verified byte-exact against the TI asm500 assembler,
and every decoded instruction re-assembles to an identical encoding (a
full-opcode-space disassemble/reassemble round-trip is stable). A 297-case
disasm test suite and an analysis test suite (opcode classification, branch
and call targets, stack effects, memory-operand fields, data-immediate values, the register
profile, named instruction ids and COFF binary-fixture function discovery)
are added, and the real-world emulateme C54x .text decodes cleanly.

* arch/tms320: add TMS320C54x RzIL lifting

Lift the C54x integer core to RzIL so emulation and IL-based analysis work
for C54x as they already do for C55x/C55x+.

- Register profile: C54x previously fell through to the C64x profile
  (a0-a31, =PC pce1), wrong for the A/B accumulator core. Add a proper
  C54x profile: the two 40-bit accumulators A/B (with the L/H 16-bit and
  G 8-bit guard slices overlapping their parent), AR0-AR7, T/TRN, SP, DP,
  BK, ST0/ST1/PMST, BRC/RSA/REA, IMR/IFR, XPC and a 24-bit PC.

- IL VM config: tms320_c54x_il_config() binds the canonical registers; the
  accumulator slices stay unbound, the lifter expresses them as bit-slices
  of A/B so they never desynchronise.

- Lifter (C55ArchDesc::lift hook, dispatched by c55_lift): the no-shift
  forms of LD/LDU/LDR/LDM, ADD/SUB/AND/OR/XOR, STL/STH/STLM/STM, the mvd*
  memory-to-memory moves, the DLD/DST 32-bit double-word load/store (high
  word at the lower address), PSHM/POPM and RET. Shift/round/saturate
  variants are left unlifted (their shift count is carried only as a
  display string); the engine's generic EA/read/write/post-modify helpers
  are reused for the addressing modes.

Tested via two new RzIL VM blocks in test/db/rzil/tms320: a register/
immediate/memory execute test, and an end-to-end emulation of the
emulateme binary's _decrypt (a UART hex-writer) showing the IL VM emits
the hex digits and advances the write position.

---------

Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-20 05:28:41 +08:00
Premade
aeb6fb1cf6
refactor: move rz_core_types_rename to rz_core.h (#6536) 2026-06-20 02:54:56 +08:00
Farhan Saiyed
3ad6e786ad
Add missing spaces in R! help (#6528) 2026-06-19 13:44:11 +00:00
NOT XVilka
9217b0a86a
librz/arch/sh: add SuperH-3 support via asm.cpu (#6531)
Co-authored-by agent: Claude/Claude-Opus-4.8
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-19 04:37:30 +08:00
NOT XVilka
070c004e0c
rz-find: flush output to avoid undeterminism (#6527)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-18 14:56:02 +08:00
Rot127
110c812219
librz/arch/x86: fix ADC, AND, OR, SBB RzIL lifting (#6524)
* Cast operands for AND and OR instructions to the correct width
* Add missing operand casts for SBB and ADC.
* Add flawed instructions to asm tests

---------

Co-authored-by: Dhruv Maroo <dhruvmaru007@gmail.com>
2026-06-18 11:07:43 +08:00
MrQuantum1915
b9d2a03be3
librz/core/tui: fix panel mode and visual modes cmd format and redundant quotes (#6520)
* Fix and add new gadget search cmds
* Fix some more commands and menus
* Fix /a error message
2026-06-18 11:06:17 +08:00
NOT XVilka
f205e231ef
arch/tms320: drop c55x+ global state, populate op->val, lift rptadd/rptsub (#6525)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-18 03:52:09 +08:00
NOT XVilka
36433ae7a1
build: fix rz_bin_stabs.h hdr install (#6526)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-18 03:46:03 +08:00
NOT XVilka
e43565fade
librz/core/disasm: dedup symbol name when realname is used (#6518)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-17 11:22:30 +08:00
NOT XVilka
8fde88fd9e
rz-asm: show an error when -m arg is invalid (#6519)
Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
2026-06-17 11:22:17 +08:00