* Add ecl command using YAML details feature
Implement new ecl command to list color palette keys with descriptions
using Rizin's YAML command generation system.
- Add ecl command definition in cmd_eval.yaml with details section
- Add handler function to iterate and print color names with descriptions
- Add test case for ecl command
- Use ^anchor in grep to avoid substring matching issues
Fixes#5462
* Fix padding in ecl command output
Adjust padding calculation from max_len+1 to max_len+2 to match
expected spacing in test output.
* Removed colon from ecl command output for cleaner format
* Add color visualization to ecl command output
Implement colored blocks (##) in ecl command output, similar to the ec command.
This provides visual representation of each color alongside its description.
* refactor h8300 register handling and improve operand definitions
h8500: add h8500h/l support
* Fix operand references in H8300 assembly instructions and update operand width handling
* Add support for H8300 instruction formats with 32-bit immediate values
* Refactor H8300 instruction decoding and operand handling for improved clarity and maintainability
* Refactor H8300 instruction decoding to enhance CPU type handling and improve code clarity
* Add H8300L specific instruction decoding for MOVFPE and MOVTPE
* Refactor stack pointer handling for H8300 instruction set to support CPU type differentiation
* Add H8300H specific register profile to enhance CPU differentiation
* Refactor H8300 instruction handling to improve CPU type differentiation and clarity
* Enhance H8300 instruction handling for CPU type differentiation in post-increment and pre-decrement operations
* h8300: add explicit `inline` mark
* fix: format with clang-format-20
* fix: fix clang-format linter with rewrite '^#define.*/\*.*\\$'
* fix: update clang-format to version 20 in workflows and documentation
* fix: add SPDX license information to .git-blame-ignore-revs
* 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.
* Type parser can now handle parenthesized declarations correctly
* Also make the type pretty-printer print nested callables
correctly and also take into account arrays in nested callables
* Add test for nested callable type parsing and printing
* Fix breaking test
* Add a unit test for the new type parsing/printing logic
* Fix the pretty printing by using the correct order for wrapping types
* Fix how the function pointer types look in pdb integration tests
* Format according to clang-format
* Change the logic for adding parens for the innermost wrapping type
* Fix broken integration tests
* Add type annotations for RzPVector; Initialize variable to fix build
* add h8/500 plugin stub
* refactor h8500 instruction parsing and disassembly logic
* fix: remove debug print statement from h8500 EA parsing
fix: correct plugin name from h8300 to h8500
add: new test case for h8500 disassembly
* refactor: improve operand parsing and disassembly logic for h8500
* refactor: update operand representation in h8500 EA parsing
* refactor: enhance operand definitions and add test cases for h8500 instructions
* fix: add h8500 disassembly plugin to command lists
* refactor: enhance H8500 instruction and operand structures for better parsing
* refactor: update H8500 instruction set with size suffixes and enhance operand handling
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* refactor: update H8500 operand handling and address mode definitions for consistency
* refactor: update H8500 addressing flags and operand handling for consistency
* refactor: update H8500 immediate operand syntax to use '#' prefix for consistency
* refactor: update H8500 addressing modes and mnemonics for consistency
* refactor: add new H8500 instructions BNOT, BSET, BSR, and BTST with operand handling
* refactor: update H8500 opcode definitions and add new CLR and CMP instructions
* refactor: add DADD instruction to H8500 opcode definitions and update related tests
* fix: correct memory copy size in h8500_instruction_parse function
* refactor: add DIVXU, EXTS, and EXTU instructions to H8500 opcode definitions and update tests
* refactor: add JMP instruction to H8500 opcode definitions and update tests
* refactor: add JSR instruction to H8500 opcode definitions and update tests
* refactor: add LDC, LDM, and LINK instructions to H8500 opcode definitions and update tests
* Update librz/arch/isa/h8500/h8500.c
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* refactor: update H8500 addressing mode and operand flags to use ut64 type
* refactor: update H8500 addressing modes and add MOV instruction test cases
* feat: add MOVFPE, MOVTPE, and MULXU instructions to H8500 opcode and assembly
* feat: add NEG, NOT, and NOP instructions to H8500 opcode and assembly
* feat: enhance H8500 opcode with new instructions and EA flags
* fix: change enum to typedef enum for addressing mode definition
* pjmp
* pjsr | prts
* rot*
* rt*
* scb
* sh*
* sleep | stc | stm
* sub*
* swap
* tas | trapa | trap/vs | tst
* fin disas
* fix header
* add h8500_reg_name function to retrieve register names
* implement H8500 instruction analysis and operand value extraction
* refactor H8500 addressing modes and operand definitions for clarity
* fix msvc 2017 build
* fmt
* fix: update description for H8500 disassembler plugin
* fix: cmd test
* fix: coff h8500 support
* add author and cpus
* fix: test cmd
* feat: add instruction operand string retrieval and new instruction test
* fix: change operand length type from size_t to int in h8500 instruction parsing functions
* feat: add dsub instruction and update operand syntax in h8500 assembly files
* feat: update h8500 opcode descriptions and add new branch instructions
* Fix coff permissions when rz_coff_perms_from_section_flags returns 0
* Fix missing op->size
* refactor: update addressing mode macros and improve operand handling in h8500
* Refactor assembly syntax for H8500 instructions
- Added spaces for better readability in the assembly instruction definitions.
- Updated the formatting of operand lists to include spaces around commas.
- Ensured consistency in the formatting of immediate values and register references.
- Adjusted the assembly test cases to reflect the new formatting style.
* fix: correct permissions for .drectve sections in COFF format
* feat: add initial test cases for h8500 registers and analysis
* fix: add comment to clarify H8300 machine definition in COFF specs
* fix: correct typo in expected output for h8500 analysis
* fix: update data type and constants for H8500 pattern checks
* fix: apply suggestion
* fix: update H8500 instruction encoding and address modes
* fix: add cmp.b and cmp.w instructions for H8500
* fix: refactor H8500 analysis for improved address mode handling
* fix: enhance H8500 analysis for improved operand handling and stack operations
* fix: improve operand handling in H8500 analysis for better instruction processing
* fix: update PJSR instruction format for H8500 and enhance CMP instruction handling
* fix: enhance H8500 function analysis with additional metadata for varfunc and leaffunc
* fix: add documentation and clarify PC-relative mode handling in H8500 instruction parsing
* fix: correct PJMP instruction format to include address dereferencing
* Update librz/arch/isa/h8500/h8500.c
Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: wargio <deroad@kumo.xn--q9jyb4c>
Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
* Remove unused declaration.
* Fix integration test to have a real scan example.
This also fixes a bug that the last NUL/invalid byte in a string
was not included in the UTF-8 bytes -> memory offset map.
* Add speed up search for unaligned buffers and string encodings.
The new search mode adjusts the buffer's data (swap endianness, fix alignment)
so the buffer can be searched with PCRE2 without scanning.
It also enables RzRegexMulti opbjects to have their own JIT stack.
This makes them usable in a thread safe manner.
* Fix regex compilation on big endian systems
* Update the scanning check (UTF needs no scanning anymore).
* 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
* Add function to memcpy memory with offset.
* Add count trailing zeros function.
* Add function to determine pointer alignment.
* Add helper to swap sequences of 2 bytes.
* Add helper to swap sequences of 4 bytes.
* Print pointer in warning
* Fix tests
* Use uintptr_t type to prevent undefined behavior.
* Remove alignment requirement and rely on malloc promises.
* Add in place byte swap functions.
* Move the endianness swapping into util/rz_endian
* Use GNU builtin __builtin_ctzll/clzll.
Also fixes the include guards of __builtin_clzll
and handles the undefined case of x == 0 of it.
* Add doxygen
* Add integration test for a simple string search.
* Clean up rz_str_is_false
* Doxygen
* Add rz_buf_type
* Sort search hits not just by address but also by size.
* Add a paranoid regex Hindi test.
* Add an integration test using RzCore and searching for UTF-16LE.
* Revert "Temporarily remove codecov workflow due to https://github.com/codecov/codecov-action/issues/1877 (#5366)"
This reverts commit dc5d50ce58.
* 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.
* Add thread_state register layouts for Mac-O Sparc and MC680x0 binaries.
* Prevent hitting assert by passing NULL in some cases.
If name is not a valid arch identifier, it should complain later.
* Switch to m68k name, to match the asm.arch plugin name.
* Don't ignore endianess of fat Mach-O binaries.
And if it isn't ignored check for actual endianess,
not for being a PPC binary.
* Add `obs` command to select the different versions of fat binaries.
* Fix import tests of mach-o
* Properly rest xtr_data->loaded
* Update doxygen and remove RZ_DEPRECATED flag
- separate plugin archos wise.
- move all register profiles under reg directory.
- move architecture specific from linux_debug.c and bsd_debug.c to respective files.
- replace eprintf with rz_sys_perror and RZ_LOG_*
- remove debug_native.c and reg.c
- refactor librz/debug/meson.build to compile the native plugins archos wise.
This improves code readability and maintainibility.
* Update magic implementation from openbsd to 0e59d0d commit
* Various refactoring of the original code to use RzUtil primitives instead of the custom implementation
* Remove static variables from the original code
* Remove Queue, regex_t and use RzList, RzRegex instead
* Remove unneeded code from the original implementation
* Use RZ_LOG_* macroses instead of the custom logging of the original code
* Use rz_endian primitives where appropriate
* Use os-specific functions where appropriate
* Move magic functions to internal header
This uplifts all non-trap related instructions to RzIL.
Notable shortcomings are:
- ASI (address spaces identifiers) are not implemented.
Every instruction using them defaults to the ASI 0.
This is because STORE/LOAD don't take RzIL values but constants for
memory identifiers.
- Similary floating point rounding defaults always to one rounding mode.
See SPARC_RMODE(). For the same reason as above, the rounding mode
can't be determined during runtime currently.
- Floating point exception flags (FSR.cexc/FSR.aexc) are not written.
This also happens because RzIL has currently no mechanism to hook FP
exceptions from the FP module and execute predefined RzIL code for them.
* Print warnings if a runtime exception state is reached.
* Enable the RzIL VM to halt on exceptions.
---------
Co-authored-by: NOT XVilka <notxvilka@proton.me>
* Rename librz/util/ubase64.c into librz/util/base64.c for consistency #5216
* Add Doxygen documentation to function in librz/util/base85.c #5216
* Add unit-tests for librz/util/base85.c #5216
* Refactor base85 API and internal functions #5216
base85 was using a FILE as an input and it used to print its result to
STDOUT, which was very bad for having unit-testing or to use it to
extend rz-hash functionality, since the solution I really had was
through using pipes which isn't ideal as much as the refactoring one.
* Extend rz-hash with base85 #5126
* Fix formatting #5216
* Extract base36 decoding function from subprojects/rzwinkd/iob_net.c to librz/util/base36.c #5216
- Also, added Doxygen docs to rz_base36_decode function
* Added rz_base36_encode_dyn #5216
- this function encode a u64 value to it's char[13+1] base36 counterpart
- later, it will be helpful in expanding the funcitionality of rz-hash
- added its Doxygen docs
* Expand rz-hash with base36 encoding/decoding #5216
* Refactor rz_base36_decode to return a suitable error code like -1 #5216
- that should help testing it later for valid and invalid decodings
- keeping the original behaviour as it was in
subprojects/rzwinkd/iob_net.c
* Add unit-tests for base36 encoding & decoding functions #5216
* Fix formatting #5216
* Fix base36.h header file guards #5216
* Add base32 encoding & decoding #5216
added their Doxygen Docs as well
* Add base32 encoding and decoding unti-tests #5216
* Expand rz-hash with base32 encoding/decoding functionality #5216
* Fix formatting #5216
* Fix add base32 to codec_name_bytes #5216
* Fix base32 docs #5216
* Add base16 encoding/decoding functions #5216
- added their Doxygen docs as well.
* Add base16 unit-tests #5216
* Fix test_base85 conversions warnings #5216
* Expand rz-hash with base16 encoding/decoding functionality #5216
* Fix formatting #5216
* Fix doxygen docs #5216
* Restore subprojects/rizin-shell-parser/parser.c to match origin/dev
* Fix the order by baseXX
* Fix base16 - invert the logic in calculate_src_length
* Fix base16 - intialize variables in rz_base16_encode
* Fix base16 - null terminate the output buffer of rz_base16_encode_dyn
* Fix base16 - get rid of unnecessary else in rz_base16_decode
* Fix base16 - use `len & 1` instead of `(len % 2) != 0`
* Fix base32 - invert the logic in calculate_src_length
* Fix base32 - compress two return statments by using `rz_return_val_if_fail(src && dest, 0);`
* Fix base32 - null terminate the output of rz_base32_encode
* Fix base32 - get rid of unnecessary else in rz_base32_decode
add more parentheses to split addition from mult for better clarity
* Fix base32 - intialize variables in rz_base32_encode_dyn
* Fix base36 - intialize `tmp` variable in rz_base36_encode_dyn
* Fix base36 - use RZ_LOG_ERROR instead of eprintf
* Fix base36 - use RZ_NULLABLE for the API interface
* Fix base85 - use RZ_OUT & RZ_NULLABLE for the API interface
* Fix base85 - use RZ_LOG_ERROR instead of eprintf
* Fix base85 - use size_t instead of int for decode_tuple_buf
* Fix base85 - remove unused varaible, `out_len`, in rz_base85_encode_dyn
* Fix base85 - correct decode buffer size calculation
The previous rz_base85_dec_buflen() underestimated the worst‑case output
size (3 bytes per 4 input chars), causing overflows when using ‘z’/’y’
abbreviations. Update it to allocate 4 bytes per input character plus
one for the NUL terminator, eliminating heap-buffer-overflow errors.
* Fix formatting
* Fix base85-test - use `newlines` variable to make sure line breaks were inserted as expected
* Fix base85-test - remove unnecessary includes
* Fix rz-hash test - updated rz-hash -L expected result
* Fix crypto_base36 - use RZ_LOG_ERROR instead of eprintf
* Fix base16 - compress rz_return_val_if_fail statements and move before locals
* Update base16 - use hex.c existing encoding/decoding logic
- base16.c encoding/decoding functions are now wrappers for hex.c
`rz_hex_bin2str` and `rz_hex_str2bin` functions
- updated related base16 unit testing and documentation
- updated the integraion with rz-hash binary (or crypto_base16)
* Fix formatting
* Add documentation to rz_hex_bin2str
* Fix base85 - add missing `reutrn` docs to rz_base85_encode function
* Fix base85 - use RZ_NONNULL for dest and src function instead of RZ_NULLABLE
* Fix base36 - use RZ_NONNULL for dest and src function instead of RZ_NULLABLE
* Fix base16 - use RZ_NONNULL for dest and src function instead of RZ_NULLABLE
* Fix base32 - use RZ_NONNULL for dest and src function instead of RZ_NULLABLE
* Fix base16 - add missig checks for invalid inputs in rz_base16_encode & rz_base16_encode_dyn
* Fix base32 - add missing checks for bad encoding
* Fix - add missing SPDX
* Fix Formatting
* Add rz_base36_encode & rz_base36_decode_dyn functions to base36 API
* Enable initialization of negative zero and add float neg tests.
* Use argument instead of another function to init negative zero.
* Use platform agnostic negative inifinity value.
* Add ?** as alias for ?*~...
* Zero initialize the help desc copy.
Fixes a bug when detail_cb was called but it was just garbage.
* Implement ?***
* Add tests for interactive command search
* Add string buffer output mode for internal use and use it for setting help.
* Add ?**e for interactive search of config values.
It loads .mdt firmware layout files, searches for the other parts in the same directory and loads them.
It resolves symbols, sections etc automatically, and maps them according to the layout
to the virtual address space.
- The iH command provides details about each firmware part as well.
- Memory maps and segment names are prefixed with the parts file name to make them distinct.
- If a firmware part is an ELF library it loads, and resolves its functions, segments etc.
Due to the design of the ELF binary plugin (code duplication with macros for 32/64bit versions),
this only supports 32bit firmware images for now.
This can relatively easily be fixed, by duplicating this plugin but including the 64bit ELF headers.
This requires more tests though.
It exposes commonly used ELF parsing functions in elf_parser.
They don't rely on RzBinFile but take only the ELF object.
This allows access for other RzBin plugins which rely on ELF files.
* Refactor: improve `rz-bin -L` output
Added `author` + `license` cols
Removed `bin/xtr` col
* Refactor: move `license` column + change table output
moved license column before description
table output for bin/xtr now contains `author` + `license` cols
* Add: author field for `librz/bin/p/*`
author selected on oldest SPDX owner
if same time-period then author is chosen based on git history
* Move ARM32 reloc patching into a function
* Move ARM64 reloc patching into a function
* Move PPC64 reloc patching into a function
* Add missing NONE relocs for various archs
* Move Intel 80386 reloc patching into a function
* Move amd64 reloc patching into a function
* Move rx reloc patching into a function
* Move alpha reloc patching into a function
* Handle reloc RZ_X86_64_COPY for amd64
* Move intel 80386 reloc convert into a function
* Move amd64 reloc convert into a function
* Move arm reloc convert into a function
* Move riscv reloc convert into a function
* Move aarch64 reloc convert into a function
* Move ppc reloc convert into a function
* Move mips reloc convert into a function
* Move rx reloc convert into a function
* Move alpha reloc convert into a function
* Move hexagon reloc convert into a function
* Fix wrong rename on ELF format
* Handle reloc R_MIPS_HI16 & R_MIPS_LO16
* Minimal handling of micromips relocs
* Add nanomips initial support for reloc convert
* Minimal handling of intel 80386 missing relocs
* Minimal handling of amd64 missing relocs
* Minimal handling of arm missing relocs
* Minimal handling of riscv missing relocs
* Minimal handling of aarch64 missing relocs
* Minimal handling of ppc missing relocs
* Minimal handling of ppc64 relocs
* Split reloc patching & conv from bin_elf.inc
* Split aarch64 from arm32 in elf_imports.c
This allows to test for assembly characteristics which are only valid in a certain context.
Here we also fix a bug in rz-asm, which didn't incremented the address before disassembly.
* Added build files [Capstone to Zydis]
* x86 Analysis [Capstone to Zydis]
* Changed x86 RzIL [Capstone to Zydis]
* Changed asm and arch files [Capstone to Zydis]
* Compilation, build error and test fixes [Capstone to Zydis]
* Test changes [Capstone to Zydis]
* Remaining changes [Capstone to Zydis]
* Added BE support [Capstone to Zydis]
---------
Co-authored-by: tushar3q34 <tushar3q34@gmail.com>
* Add `rz_goto_if_reached()` to RZ_CHECKS_LEVEL 3
* Fix rz_return(_val)_if_reached() for RZ_CHECKS_LEVEL 0
* Add `rz_goto_if_reached()` to RZ_CHECKS_LEVEL 0
* Set default log level to WARN
* Fix asm tokens leaking horrendously because they used Vector and PVector.
* Fix some resource leaks related to asm tokens
* Fix some resource leaks of the hexagon module error cases.
* Fix possible NULL ptr dereference
* Fix leak of asm tokens by fun fini on RzAsmOp.
The RzAsmOp passed here could be a previously initialized one.
With allocated asm_tokens. Doing memset just leaks those tokens.
* Simplify the copy_asm_op function
* Always fini RzAsmOp before initializeing it.
* Set asm_toks to NULL after freeing
* Fix leak in asm_bf
* Fix leaks in test_token
* Initialize all RzAsmOps with 0 and free the asm_toks on init.
In practice rz_asm_op_init() is the best place to free the asm_toks reliably.
Simply because this is always called in the old code, before an instruction is disassembled.
Only in fini() is not enough, because there are too many place it is not called, leaking the tokens.
* Fresh mind, new attempt. Fini asmop at all occurrences of rz_asm_disassemble
The pointer contents could be assumed to not change during the test by
the compiler with certain optimization levels, leading to instant
failure.
This became visible on Gentoo/amd64 with all-default meson options.
entries_initfini_print() with initfini=false is only called by the 'ie' command handler.
'ie' prints entrypoints, so users should also be able to see all entrypoints (of any type)
the binary has. This was also the plan as it looks like, because further down
the entry point type is also emitted. But since initfini=false for 'ie'
only entries of type RZ_BIN_ENTRY_TYPE_PROGRAM were printed.
* add python support for version 3.12.0
* add test for pyc 312
* add missing analysis
* Added Python 3.13 support
* refactor store_op and add opcodes for 3.13.0a1 to 3.13.2
* update license
* Add `/ce` and `/cef` commands and provide better args for entropy search
* Fix comments and more thread safety
* Extract sm4 master key as detail
* Fix comment
* Fix UB access of NULL context.
During the tests the global RzCons is accessed. Because it was
never initialized all members were 0.
Leading to undefined behavior and breaking the test with ASAN enabled.
* Use correct yaml example for the command described.
* Remove old shell compatibility code.
* Remove dependency tree of rz_core_cmd_subst() and rz_core_cmd_subst_i().
* Remove rz_core_cmd_pipe_old()
* Remove unused rz_core_hack_help()
* Regenerate grammar after removal of legacy_quoted_stmt.
The instructions were found correctly since the search refactor.
But the address of the hit was set to the second instruction.
This adds the tests discussed in the issue and sets the address
of the hit to the first instruction.
* ci: Upgrade to Ubuntu 24.04 (Noble)
* Install clang-format-16 directly from the Noble repo
* Remove redundant gcc 11 ASAN build
* Count `dm` map items more granularly in `dbg_maps` test
* Grep only for exception symbols in `dbg_dmi` test
* Add workaround for `dbg_maps` test
* Mask out different digits in `dbg_dmh` test
* Add workarounds for sprintf false positives
* For now, use `-fno-sanitize=function` with clang asan build
* Port /m to RzShell
Co-authored-by: wargio <deroad@kumo.xn--q9jyb4c>
* Fix typos and fix grammar.
* Add a comment member to a search hit. For storing longer descriptions.
* Add tests
* Further details what rz_search_opt_set_chunk_size does
* Refactor pm to show long descriptions of magics.
* Check search.to is never smaller than search.from.
* Port /mb to RzShell.
* Fix tests
---------
Co-authored-by: wargio <deroad@kumo.xn--q9jyb4c>
- handler from pic_midrange_esil.inc needs to be always called, because
it also fills basic info.
- Rizin maps a single PIC instruction to two bytes, so jump targets
in disassembly need to be adjusted accordingly.
- Many op types incorrectly defaulted to nop, e.g. making analysis skip
them at function beginnings. Now they are more meaningful.
- jump values in RzAnalysisOp for PIC were using dynamic esil reg
contents, but when failing to read them, used uninitialized garbage
memory. Now pclath and wreg are considered as always 0 there with the
option to add static heuristics later.
* Port `px/` to RzShell.
* Escape string before emitting it for psb.
'psb' just emitted the whole string. It ignores the posibility that it might
contain escape sequences which mess up the output.
In the specific case of the fixed test this happened. The invalid string
contained some invalid escape sequences and cut of the output afterwards.
* Rename `px/` to `pxF`
Regression from 3b7f2730f2:
rz_io_nread_at stops at unmapped regions, but disassembly being a
user-visible display needs to show gaps as 0xff and mapped regions after
with their contents again instead of just breaking and showing io->Oxff.
The exact meaningd of rz_io_nread_at and rz_io_read_at_mapped have also
been clarified in documentation comments and tests.
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>
Adds the byte search implementation of the new search.
The normal byte search works just as before.
But adds way more examples in the help message and more test cases.
Additionally, it adds an regex byte search.
Part 7/9. Likely won't build in between parts.
Co-authored-by: wargio <deroad@kumo.xn--q9jyb4c>
- This commit adds the ability to print any supported string encoding
with 'ps' (also EBCDIC).
- Adds alias 'psu' for 'ps utf8'
- It also allows to select unprintable characters as string delimeter.
Part 4/9. Likely won't build in between parts.
Co-authored-by: wargio <deroad@kumo.xn--q9jyb4c>
This commit changes several settings. The main reason is to have them
contained in one search group, and not spread over the search and string group.
This becomes important with the search refactor, since the search is now also
more contained in a single module and can make use of the more settings.
- Remove str.search.max_uni_blocks - Effectively a metric the user should not know about; adds too much complexity. Also not documented.
- str.search.encoding -> str.encoding - Valid for all string interpretations.
- str.search.max_threads -> search.max_threads - This is a general setting for the search now.
- str.search.raw_alignment -> search.str.raw_alignment - Unify settings (only used for RzBin search.).
- str.search.min_length -> search.str.min_length - Unify settings.
- str.search.buffer_size -> search.str.max_length - Unify settings.
- str.search.max_region_size -> search.str.max_region_size - Unify settings.
- str.search.check_ascii_freq -> search.str.check_ascii_freq - Unify settings.
Part 3/9. Likely won't build in between parts.
Co-authored-by: wargio <deroad@kumo.xn--q9jyb4c>
This commit adds several improvements, updates and fixes to Unicode related logic.
- Update Unicode tables to version 16.
- Escaped strings now escape valid Unicode code points to /Uhhhhhh and invalid code points to /xhh.
- Generally applies RzStrEscOptions way more consistently. The legacy escape is still used at some places though.
- Fix inconsistencies in Unicode decoders/encoders and checkers. They now either return 0 on an invalid decode or the number of bytes the code point requires.
- Add many unit tests for Unicode related logic.
- Add helpers to check code points.
Part 2/9. Likely won't build in between parts.
Co-authored-by: wargio <deroad@kumo.xn--q9jyb4c>
Implements most of the normal MIPS32 isa from MD00086 Rev 5.04
Breakpoints, syscalls, interrupts, TLB, cache, prefetch and traps are NOP
Does not implement MIPS64, FP, COP2 and HW operations.
* Fix definition of alignment.
Alignments for code and data is not defind for 0, bubt nonetheless it
was assigned this value everytwhere. This changes the default value to 1.
* Enforce an alignment of at least 1.
* Fix alignment checks (default is now 1).
* Fix alignment check. 1 was assumed to be valid.
* Fix places where an alignment of 0 is considered still a valid value.
* Fix integration test with invalid alignment
* Remove debug printf
* Remove addrmod member.
It was pressumingly used to indicate aligned addresses in print mode.
But it wasn't documented and the usefulness is dubious.
Since it is easy to spot for users to see if addresses are aligned or not anyways.
* Fix tests after cherry-pick
* Fix rz-find test which consumed the '-X' as number value for '-a'.
* Fix case of arch module not defining value alignments.
* `/e`: Set `RZ_REGEX_MULTILINE` for `^` and `$`
* Add note in `/e` help for `^` and `$`
Co-authored-by: Rot127 <45763064+Rot127@users.noreply.github.com>
The previous description was confusing. Because a Rune is not a defined term for Unicode encodings (except of course the ancient runes).
Because the type seems to be always used as "Unicode code point" this rename should bring clarity.
* Fix UTF16 decoding.
Surrogate cases were not handled correctly.
* Clean up UTF16 API functions:
- Rename parameters to be more descriptive.
- Add RZ_NONNULL and RZ_OUT.
- Add asserts and remove unnecessary if checks.
- Add doxygen.
* Fix utf16 encode to allow codepoints up to 10ffff.
* Fix: UTF16 decoder decodes 2 bytes if 4 had the wrong surrogate.