Commit graph

28 commits

Author SHA1 Message Date
Cheese Cake
a99cc738c2
util: extend string search with user-defined printable characters (#6161)
* util: extend string search with user-defined printable characters
* util: use RzVector for user_unprintable options
* util: address review for configurable unprintable chars
* core/cconfig: use goto error_free pattern in cb_str_unprintable
* test/cmd_search_z: merge duplicate Armenian utf16le tests
2026-05-01 22:47:14 +08:00
Giovanni
9d5dc6edd1
Cleanup luac code (#6298) 2026-04-30 16:57:47 +08:00
Giovanni
17e19ac887
Log an error when endianness change is not compatible with arch (#5945) 2026-02-23 11:06:41 +08:00
Khairul Azhar Kasmiran
e4ed1d3436
Fix "exeeds" typo (#5760) 2026-01-09 21:26:26 +08:00
Giovanni
0a0e6c0b88
Optimize queue to act also as proper channel (#5627) 2025-12-20 00:40:13 +08:00
Peiwei Hu
595be1780c
Fix multiple memory leaks (#5636) 2025-12-18 14:23:48 +00:00
Giovanni
0b33d19d60
Optimize tests to recover some CI runtime (#5601)
* Optimize cmd_print tests
* Fix nullderef in bfile_string.c and optimize cmd_i
* Disable esil runs on appveyor
* Fix obviously wrong time scale in rz-test
* Add more info about -e option when in log mode or verbose
2025-12-11 13:46:31 +08:00
Rot127
67dd136e60
librz/bin: fix leak of byte_mem_map (#5529) 2025-11-16 09:31:04 +08:00
Rot127
4872db027b
librz/bin: fix memory leaks (#5448) 2025-10-11 13:16:04 +08:00
Rot127
d79ff51157
librz/bin: define string search parameters in plugins (#5406)
* Clarify docs of raw_alignment

* Set Go and Rust string encoding for binary string search.

* Add detailed doxygen about string search in bin plugins.

* Add the number string code points as detail to string search hits.

* Add helper to check if string encoding needs scanning.

* Add helper to generate a string wildcard pattern.

The pattern is supposed to match any human readable string.
Before the string search refactor there was no explicit definition
what characters mark the end of a string and which ones don't.

This pattern should match strings of the old interpretation.

* Enable the RzBin plugin to search strings with direct matching instead of scanning.

This significantly speeds up the string search when a binary is opened.
The prerequisite is that the plugin specifies the string encoding.

* Enforce UTF-8 for initial string search.

* Add custom string search for PE files.

* Clean up and document rz_utf8_encode

* Don't demote explicit UTF-8 encoding to ASCII.

* Increase min JIT stack size due to not reproducable search results.

* Simplify wildcard regex pattern.
2025-10-08 10:02:32 +08:00
Rot127
9705b44f6e
Enable string search collection to search for multiple encodings. (#5378)
* Enable string search collection to search for multiple encodings.

This moves the encoding and alignment properties out of the collection
object into the RzDetectedStr object.
It essentially removes duplicates of this info.

Because of this move, rz_search_collection_string_add() will now
check for invalid collection configurations.

* Rename type -> encoding
2025-09-17 10:54:31 +08:00
Peiwei Hu
1d9eac6b6d
Refine the output of iz command and remove ordinal in RzBinString (#5122)
* Refine the output format of iz command

* fixup! Refine the output format of iz command

* fixup! fixup! Refine the output format of iz command
2025-05-23 13:46:30 +00:00
Rot127
864d970869 String/Hex-Search 8/9: Add vastly improved string search.
Adds the new string search implementation, fixes many bugs and makes performance improvements.

- Adds support to search reliably for all supported encodings (fixes non-ASCII string search).
- Fixes some wrong assumptions what valid code points are (e.g. 0x000000ff is a valid code point in UTF-32/UTF-16 BE).
- Adds several '/z' command options how to perform the string search (literal, regex, extended regex, caseless).
- Checks every decoded code point for validity to improve correctness.
- Improves performance of string decoding by not writing to the heap in all cases.

Part 8/9. Likely won't build in between parts.

Co-authored-by: wargio <deroad@kumo.xn--q9jyb4c>
2025-02-22 04:12:49 +08:00
wargio
c613ac3b70 Revert back only the changes for the threads code and ignores rz-test 2024-06-02 18:11:06 +08:00
Khairul Azhar Kasmiran
7b91fb69c2
Revert #4506 (#4519) 2024-05-27 21:50:58 +08:00
Giovanni
d19fc9d0d8
Add N_THREAD_LIMIT to limit the max number of threads (upper limit). (#4510) 2024-05-24 16:12:08 +08:00
pelijah
f2d8e0db3d
Add HtSP, HtSS, HtSU, SetS (#4415)
- All `ht_*_new0()` are removed
- `freefn` field of HT options was renamed to `finiKV`
- `finiKV_user` fields was added to HT options
- Added `ht_*_new_opt_size` API
- `HtSP` and `HtUP` are created with `ValueFree` callback  that allows to reduce extra LOC and prevent bugs
- `SetP` replaced with `SetS` (based on `HtSP`)
- `rz_th_ht_*_new0()` and `rz_th_ht_*_new_opt()` are replaced with `rz_th_ht_*_new(HtXX *)`
2024-04-16 20:27:48 +08:00
Peiwei Hu
db7254dd79
Use rz_pvector_join instead of loop (#4320) 2024-03-03 08:09:49 +08:00
wargio
a80622bcc1 Remove old options and replace with new global ones for string search.
Removed options:
- `bin.maxstr`

Renamed options:
- `bin.minstr` is now `str.search.min_length`
- `bin.maxstrbuf` is now `str.search.buffer_size`
- `bin.str.enc` is now `str.search.encoding`

New options:
- `str.search.reload`
- `str.search.max_threads`
- `str.search.max_uni_blocks`
- `str.search.max_region_size`
- `str.search.raw_alignment`
- `str.search.check_ascii_freq`
- `str.search.mode`
2024-02-19 19:39:00 +08:00
Peiwei Hu
3a2148e1cd
Refactor sections in RzBinPlugin from list to pvector (#4089) 2024-01-11 12:19:22 +08:00
wargio
f7589feb05 introduce user pointer in comparator to remove globals in table.c 2024-01-06 23:30:07 +08:00
Peiwei Hu
b43fe31877
Transition of strings in RzBinPlugin (from RzList to RzPVector) (#4052) 2024-01-04 22:23:31 +08:00
Anton Kochkov
9c6feafd47
Prefer BE in strings search when it is known (#3588) 2023-06-19 13:19:50 +08:00
Anton Kochkov
a9096718e9
Coverity fixes - memory leaks, NULL dereferences (#3339)
* Fix CID 398788 - memory leak

* Fix CID 397077 - remove useless comparison

* Fix CID 397076 - remove useless comparison

* Fix CID 397074 - remove useless comparison

* Fix CID 396207 - memory leak

* Fix CID 392014 - bad shift

* Fix CID 391965 - NULL dereference

* Fix CID 390010 - wrong assert use

* Fix CID 378899 - unitialized variable

* Fix CID 378859 - integer overflow

* Fix CID 366898 - remove useless comparison

* Fix CID 364035 - NULL dereference

* Fix CID 317001 - closing "-1" file descriptor

* Fix CID 316991 - lseek() to negative position

* Fix CID 316172 - mmap() with negative size

* Fix CID 401510 - double free

* Fix CID 395360 - remove useless comparison

* Fix CID 352574 - negative loop bound

* Fix CID 316187 - memory leak

* Fix CID 395425 - memory leak

* Fix CID 316975 - buffer overrun

* Fix CID 316947 - memory leak

* Fix CID 398474 - integer overflow
2023-02-04 20:01:42 +08:00
Dean
59b38e6efa
Add /*<type>*/ comments everywhere (#2986)
Adds /*<type>*/ comments and a linter check from rz-bindgen to enforce
their existence and consistency

Also includes the following fixes made when adding the annotations:
* removed unused intern_table arguments in pyc_dis.c, pyc_dis.h, asm_pyc.c
* removed unused classes argument from place_nodes in agraph.c
* removed unused recurse and recurse_bb functions in canalysis.c
* removed unused vars field from RzPrint struct
* removed unused RzAnalysisType* structs from rz_analysis.h
* removed unused list field from RzEgg struct
* fixed bug in bp_plugin.c where duplication-checking logic iterates over the wrong list
* removed unused q_regs field from RzDebug struct
* removed unused backtrace field from RzDebugPlugin struct
* removed unused classes_list field from RzBinNXOObj struct
* removed unused methods_list and classes_list fields from RzBinZimgObj struct
2022-09-11 13:04:53 +08:00
wingdeans
a6a7a5f530 Fix annotation inconsistencies 2022-08-03 00:29:56 -04:00
Giovanni
522ab57c75
Remove rz_th_kill, rz_th_kill_free and rz_th_pool_kill (#2790) 2022-07-08 14:54:51 +02:00
Giovanni
6567e6ba4e
Multithread string search (#2665) 2022-06-27 23:34:08 +02:00