Commit graph

28622 commits

Author SHA1 Message Date
Khairul Azhar Kasmiran
0d70da2d4d
Add py38-expat package to netbsd.yml (#3836) 2023-09-06 19:31:58 +08:00
Khairul Azhar Kasmiran
785f47ee26
Implement 'add r#, K' in the x86 assembler (#3834) 2023-09-05 23:56:00 +08:00
Anton Kochkov
318a99bbad
Update rz-libdemangle (#3827) 2023-09-05 15:13:11 +08:00
ifyGecko
de938ba2ed
fixed pyc uaf (#3823) 2023-09-03 19:38:56 +08:00
David CARLIER
285ea07ab5
bsd_generate_corefile for FreeBSD adjust version since the feature is available in the 13.2 serie (#3820) 2023-09-03 19:38:40 +08:00
billow
71e6f5d450
Fix DWARF FbReg Operation eval and fuzz test (#3825)
* Fix FbReg Operation eval

* Fix RzBinDwarfEvaluationResult_to_loc and debug_line directories parse
2023-09-03 17:30:02 +08:00
Peiwei Hu
abec6b127d
Fix: wrong exit condition in rz_analysis_optype_from_string (#3821) 2023-09-03 00:52:12 +08:00
sohail1734
c9b16eaab9
Rename some of the environment variables (#3812) 2023-09-02 16:34:59 +08:00
billow
ce298395a4
Support for compressed DWARF .zdebug_* sections (#3819)
* Support for .zdebug_*

* Simplify macro.inc

* Fix ranges and loc, because it was using the wrong bigendian.

* - DW_TAG_ptr_to_member_type as Ptr type
- DW_TAG_unspecified_type as base type

* Fix union in struct
2023-09-02 15:05:18 +08:00
Khairul Azhar Kasmiran
c21764dc4d
regex: Support \S (#3817) 2023-09-01 22:43:48 +08:00
Khairul Azhar Kasmiran
681a6b04b8
Fix #3806: fuzzy dbt checks for CALL indirect on x86 (#3809) 2023-08-31 11:02:28 +08:00
sohail1734
a14d83fd65
Fix rz-diff help message (#3814) 2023-08-31 09:57:13 +08:00
Florian Märkl
7438207a12 Add OpenBSD core files to gitignore 2023-08-31 08:15:02 +08:00
Florian Märkl
952f96009d Fix loading zlib dwarf on big endian 2023-08-31 08:15:02 +08:00
Florian Märkl
c097bd7799 Fix zstd on OpenBSD/sparc64
Functions like MEM_read32 could still perform unaligned accesses on
OpenBSD/sparc64 with gcc, possibly related to gcc bug 51628. The
solution is to switch to a safe memcpy-based solution and let the
compiler do any optimizations.
2023-08-31 08:15:02 +08:00
Florian Märkl
b4a85e8904 Fix RzBinDwarfCompUnit unit_offset initialization
Referencing unit during its own initial assignment made it contain
garbage, at least on OpenBSD/sparc64.
The added null check avoids null derefs in case the binary itself
contains garbage for the aforementioned value.
2023-08-31 08:15:02 +08:00
billow
6886b2cd45
Fix DWARF resource leaks (#3810)
* Fix 'CID 416733 Resource leak'
* Fix 'CID 416728 Unintended sign extension'
* Fix 'CID 416723 Unchecked return value'
* Fix 'CID 416721 Resource leak'
* Fix 'CID 416718 Explicit null dereferenced'
* Fix 'CID 416717 Resource leak'

* Fix multiple Resource leaks

- Fix 'CID 416716 Resource leak'
- Fix 'CID 416712 Resource leak'
- Fix 'CID 416677 Resource leak'
- Fix 'CID 416668 Resource leak'
- Fix 'CID 416667 Resource leak'
- Fix 'CID 416666 Resource leak'
- Fix 'CID 416661 Resource leak'
- Fix 'CID 416670 'Constant' variable guards dead code'
2023-08-30 20:08:11 +08:00
Maksim Kostin
0cc4a1688e
Fix several memleaks (#3811)
* Fix memleak in rz_seek_history_list_handler()
* Fix memleaks in rz_eval_getset_handler()
* Fix memleaks in visual_comma()
* Fix memleak in cmd_pxr()
* Fix memleak in arged_stmt
2023-08-30 20:04:36 +08:00
Anton Kochkov
631a8fd38c Update .gitignore 2023-08-30 10:11:52 +08:00
billow
c936299fcc
Coverity fixes - DWARF (#3807)
* Fix 'CID 416720:  Memory - corruptions  (USE_AFTER_FREE)'

* Fix 'CID 416725:  Memory - corruptions  (OVERLAPPING_COPY)'

* Fix 'CID 416730:  Memory - illegal accesses  (USE_AFTER_FREE)'

* Fix 'CID 416731 Resource leak'
2023-08-30 10:10:33 +08:00
Maxim Kostin
df024bc7fd
Fix div by zero in 's++' and 's--' (#3803) 2023-08-29 23:04:14 +08:00
Khairul Azhar Kasmiran
6d202f1698
rz-run resolve_value: Pass single-quoted strings unaltered (#3800)
* Test whether there is error on `rizin -d`

* Make env more like local env

* Add space btw `env` and its arg

* rz-run resolve_value: Pass single-quoted strings unaltered
2023-08-29 07:24:34 +08:00
billow
5999d3e824
DWARF support for load zlib and zstd compressed section (#3795) 2023-08-29 07:23:48 +08:00
Quentin Minster
06f6321007
Refactor Golang-specific analysis to use the API (#3801)
Instead of executing `aF @@f:sym.go.*` directly.
2023-08-28 18:25:14 +08:00
Quentin Minster
bf37c73cae
Restore original seek offset after iterating over flags with @@f ##shell (#3794)
* Update the golang analysis tests to seek to the main function before
  dumping strings, which was previously done as a side effect of using
  `@@f` during auto-analysis.
2023-08-28 13:19:13 +08:00
Maxim Kostin
68c33a4856
Fix segfault in rz_seek_end_handler (#3797) 2023-08-28 10:45:12 +08:00
Quentin Minster
b82215965e
Refactor pointer write command * to use the API (#3793)
* Add tests for pointer write command `*`

Some test cases override `asm.arch` for bitness compatibility reasons.

* Refactor pointer write command `*` to use the API

* Allow use of more general exprs as value for pointer write command `*` ##shell

* Instead of detecting when to write a value, and write a hexpair
  otherwise, do the inverse: detect when to write a hexpair, and write a
  value otherwise. This allows more general value exprs such as
  variables, derefs, ...

* To enable this, add an option to `rz_hex_str_is_valid` so it can
  reject a 0x-prefixed string (because 0x-prefixed strings should be
  handled as values, not hexpairs, by the pointer write command)

* Add a test case to ensure a non-0x-prefixed value arg, that's not a
  valid hexpair, now gets eval'ed as an expr by the pointer write
  command (where previously it would throw an error)
2023-08-26 23:40:31 +08:00
billow
0c1690a7fb
Fix docker build (#3792)
Fix "non-trivial designated initializers"
Fix "invalid conversion"
2023-08-26 16:25:36 +08:00
Khairul Azhar Kasmiran
40b67c2f6d
Fix cmd_pointer test on Travis (#3791) 2023-08-26 14:13:21 +08:00
Quentin Minster
eb78e75cd4
Refactor the pointer command to use the API (#3788)
* Add test for pointer read command `*`

Test for `asm.bits=8` uses `asm.arch=6502` because `asm.bits=8` is
unsupported for the default arch.

* Fix pointer command `*` broken since move from `?` to `%` ##shell

* Refactor to use appropriate existing API in `num_callback`
2023-08-26 02:12:47 +00:00
sohail1734
cafebbf9c3
Actualize rizin and rz-diff man pages 2023-08-26 09:38:18 +08:00
billow
8e29b959b8 DWARF improve DWARF5 support and refactor
- `RZ_PROJECT_VERSION` 14
- Add `RzCallable`.has_unspecified_parameters
- Add `RzAnalysis`.debug_info
- Add `RzAnalysisVarStorageType` composite and `eval` `pending`
- Support for parse DWARF section "debug_loclists", "debug_ranges", "debug_rnglists"
- Partial support for eval DWARF expr_loc
- Support for anonymous Type, function variable, struct member
- Cache all DWARF information in `RzAnalysisDebugInfo` and remove `SDB` based caching.
- Add arm32, arm64, TriCore DWARF register name
- Fix same name basetype
2023-08-25 23:32:05 +08:00
billow
908c2adc54 RzUtil add new API
- rz_bits_leading_zeros
- rz_json_eq
- rz_json_string_eq
- RZ_STR_EQ
- RZ_STR_NE
- rz_vector_clone_into
- sdb_diff_eq
2023-08-25 23:32:05 +08:00
billow
ec2cff8451 RzType add new APIs
- rz_base_type_clone_into
- rz_base_type_clone
2023-08-25 23:32:05 +08:00
Marcin Sobczyk
067c32ad18 Fix syscall preprocessing
'rizin' is missing a lot of syscalls for i.e. arm. We can check that
with:

 rizin -a x86_64 -b 64 -k linux -q -c asl

vs

 rizin -a arm -b 64 -k linux -q -c asl

'rz_syscall_item_new_from_string' splits the incoming string by commas
and expects at least 3 items as a result. This patch fixes
syscall preprocessing by appending empty strings to match the expected
number of items after a split.

This is a clone of a fix posted to radare2 [1].

[1] https://github.com/radareorg/radare2/pull/21508
2023-08-25 12:04:32 +08:00
Marcin Sobczyk
7a3da1691c Remove duplicate entries from 'linux-arm-64.sdb.txt'
This is a cherry pick of [1]. The removed mappings overwrite previous
entries and cannot be found in [2].

[1] c67c47ed73
[2] https://github.com/torvalds/linux/blob/master/include/uapi/asm-generic/unistd.h

Signed-off-by: Marcin Sobczyk <msobczyk@redhat.com>
2023-08-25 12:04:32 +08:00
Peiwei Hu
a5780a3855
Refactor imports-related stuff from RzList to RzPVector (#3781)
+ Switch the member imports in RzBinPlugin from RzList to RzPVector
+ Also switch the member imports in RzBinObject from RzList to RzPVector to meet the refactor of RzBinPlugin
+ Modify the traverse and invocation related to the aforementioned changes
+ Remove the deprecated API rz_bin_get_imports
2023-08-24 16:14:32 +08:00
ur4t
f0c932f2cf
subprojects/zlib: Improve meson.build, emulating configure script (#3759)
* subprojects/zlib: Improve meson.build, emulating configure script
* Update zlib to 1.3
2023-08-24 12:32:38 +08:00
Pavel I
762feed1b6
Fix several memleaks (#3779)
* Fix memleak in rz_il_handler_empty()

* Fix memleak in compare_op()

* Fix memleak in assign_reg()

* Fix memleak in rz_asm_op_fini()

* Fix memleak in rz_core_analysis_bytes()

* Fix memleak in add_sub_op()

* Fix memleak in bitwise_op()

* Fix memleak in shift_and_rotate()
2023-08-24 07:53:33 +08:00
Anton Kochkov
2cbe8fe0f0
Update capstone-v5 to 5.0.1 (#3777) 2023-08-23 16:00:11 +08:00
Peiwei Hu
9ae479c22a
Update the clang-format version in DEVELOPERS.md (#3776) 2023-08-23 10:19:26 +08:00
Peiwei Hu
03dd2d222a
Fold same-typed variables if there are more than 3 (#3770) 2023-08-20 02:38:55 +08:00
Riccardo Schirone
a91169e951
Add '%$' command to deal with rizin variables (#3774) 2023-08-19 09:19:56 +08:00
Giovanni
ac389d95dd
Unify crypto plugin api to match all the other plugins. (#3773) 2023-08-18 23:25:41 +08:00
Peiwei Hu
8b792f5a81
Fix: overflow of core->block in the handler of plf command (#3762) 2023-08-18 10:01:41 +08:00
Giovanni
305a2cb3ae
Add SM3 hash (#3769) 2023-08-17 21:59:06 +08:00
Anton Kochkov
2c9b0d86a5
visual: mention o key in help (#3757) 2023-08-17 20:29:53 +08:00
Anton Kochkov
e26ae5f63c
visual: remove prc=a mode (#3758) 2023-08-17 16:04:38 +08:00
Florian Märkl
d8aeabb501
Fix blake3 build with incompatible assemblers (#3764)
Apple Clang 4.2 on Mac OS X 10.7 Lion does support avx2, but it has
issues with some of the asm syntax used, in particular jc and some mov
syntax.
So we add an additional check for a short assembly snippet.
2023-08-17 09:51:57 +08:00
Pavel I
061c56f4c4 RzStrBuf: remove weakref related code 2023-08-15 09:00:22 +08:00