Commit graph

40 commits

Author SHA1 Message Date
Peiwei Hu
5d053f0448
Refactor the <entries> in RzBinPlugin from list to pvector (#4118) 2024-02-25 19:42:25 +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
Peiwei Hu
c0f62c529b
Refactor <libs> from RzList to RzPVector in RzBinPlugin (#3961) 2023-11-08 15:51:41 +08:00
Peiwei Hu
0e6ca28841
Refactor trycatch and classes from RzList to RzPVector (#3859)
* Refactor trycatch-related stuff from RzList to RzPVector
* Refactor classes-related stuff from RzList to RzPVector
* classes in RzBinPlugin (RzList -> RzPVector)
* classes in RzBinObject (RzList -> RzPVector)
* remove the deprecated API rz_bin_get_classes
2023-09-17 10:57:20 +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
Giovanni
8f2eb45b84
Add bin.demangle.flags to allow users to simplify or not mangled strings (#3659) 2023-07-17 23:31:09 +08:00
Giovanni
59080758fb
Split bin field from class fields and fix demangling on java (#3479)
* Split Bin Field from Class fields.
* Fix tests and plugins
2023-04-26 15:25: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
4dfad73567
Remove RZ_BIN_STRING_ENC_* in favor of RZ_STRING_ENC_* (#2716) 2022-06-21 18:45:09 +02:00
Anton Kochkov
e835652470 Rename RZ_STRING_TYPE_* to RZ_BIN_STRING_ENC_* 2021-10-16 11:33:48 +08:00
Giovanni
e224ee7b28
Add demangling as plugins and libdemangle as external dependency (#1656)
* Added demangling as plugins and libdemangle as external dependency
* Added iDl to return the list of demanglers
* moved demangling tests into rz-libdemangle and keep only bin tests
2021-10-01 10:45:38 +00:00
Khairul Azhar Kasmiran
caf1ffbeb3
rz_utf8_decode(): Remove Java \0 overlong special case by adding mutf8 decoder (#1773) 2021-09-29 21:12:49 +08:00
Giovanni
8ace435328
Fix coverity bugs (#1654)
* CID 316614: Use after free (USE_AFTER_FREE)
* CID 316535: Use after free (USE_AFTER_FREE)
* CID 316652: Use after free (USE_AFTER_FREE)
* CID 316504: Unsigned compared against 0 (NO_EFFECT)
* CID 316439: Resource leak (RESOURCE_LEAK)
* CID 356127: Dereference after null check (name can never be NULL)
* CID 320881: Resource leak (RESOURCE_LEAK)
* CID 320885: Missing break in switch (MISSING_BREAK)
* CID 316679: Resource leak (RESOURCE_LEAK)
* CID 316574: Explicit null dereferenced (FORWARD_NULL)
* CID 356105: Resource leak (RESOURCE_LEAK)
* Fixed uninitialized building issue
2021-09-11 09:30:57 +02:00
wargio
7146b3af75 Revert "Added support to swift demangling (#1595)"
This reverts commit b6259bd31f.
2021-09-06 17:09:51 +02:00
Giovanni
b6259bd31f
Added support to swift demangling (#1595) 2021-09-06 15:14:14 +02:00
Riccardo Schirone
1c78aee3cd
Convert i commands to rzshell (#1238)
* Start to create some RzBinObject specific API

Adding some unit tests

Fix for new relocs storage system

Fix test_bin unit test for oob-write

* Add `iA` command to newshell

Add `ie`/`iee` commands

Add support for `is`/`iE` commands

Add support for `ii` command

Add support for `il` command

Add support for `iM` command

Add support for `ir` command

Add support for `iS`/`iSS` commands

Add support for `iz` command

Add support for `i` command

Add support for `ic` command

Add support for `iC` command

Add support for `ih` and `iHH` commands

Add support for `iI` command

Add support for `iL` command

Fix descriptions of commands already converted

Add support for `idp` commands

Add support for `iD` command

Add support for `im` commands

Add support for `iR` command

Add support for `it` command

Add support for `iV` commands

Add support for `iw` command

Add support for `ix` commands

Add support for `iZ` command

Add support for `ik` command

Add support for `is.` command

Add support for `iS.` command

Reduce arguments in print_arch

Few Doxygen and ownership annotations

Add support for `iS=` command

Add support for `izz` and `izzz` commands

Add support for `ib` command

Add support for `ic*` command

Put section flags as the last field of the table

* Proper language detection.

* Rewritten blang.c

* implemented `icc/icm/icf <class name>`

* ignore blocks when printing langs

Remove num from `iA` output

* Fixed flags on java and added class column

Add support for `ia` commands

Fix `iCj` command

* RzBin: add rz_bin_object_sections_mapping_list API

* Fix rz-bin for new API

Remove unused va var in rz-bin.c

Fix `iA`/`-A` output

* implemented classdump_cpp

* Support namespaces

Use `icc`, `icl` does not exist anymore

Update output of broken tests for `icc`

Add `rz_return_*()` asserts in new `*_print()` functions

* Provide rz_core_bin_print API

* Select which parts to print also based on the mode

* Return bool from all `rz_core_bin_*_print()` API

* Use RzBinFile in new `rz_core_bin_*_print()` API

* Restore `dbg_dmi` test

* Remove oldshell handlers for `i` commands

* Remove `ieq` call in rizin, not needed

* Allow NULL `bf` in `rz_cmd_info_handler()`

* Re-add support for RZ_BIN_PREFIX for symbols/sections/segments/imports/relocs

* Move `ib` command to `obR`

* Show 'N/A' in `i` command when info are not available

* Assert on bf->o, just to be sure

* Make error messages clearer in `idp` commands

Co-authored-by: wargio <wargio@libero.it>
Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
2021-09-04 22:37:05 +08:00
Giovanni
02d57928f6
Fix DEX & Java Coverity reports (#1568)
* CID 355574: Resource leak (RESOURCE_LEAK)

* CID 354859, CID 354871, CID 354878: Dereference after null check (FORWARD_NULL)

* CID 354867: Explicit null dereferenced (FORWARD_NULL)

* CID 355572: Dereference after null check (FORWARD_NULL)
CID 355575: Use after free (USE_AFTER_FREE)

* CID 355576: Use after free (USE_AFTER_FREE)

* Fixed typo
2021-09-02 00:24:24 +08:00
Giovanni
b8213b0a27
Fix various bugs linked to fuzzing bins (#1529)
* [le] break when relocation is not appended into list.

* [mach0 symcache] fixed OOB read and memory leak on fail.

* [pyc] fixed OOB write when extra byte must be written.

* [ne] fixed OOB read and double-free

* [ne] Fixed shift which is bigger than 32bits and OOB read

* [ne] Fixed OOB read

* [ne] sanitize symbols names

* [ne] Fixed OOB read

* [java] ensure that methods always have names

* [le] fixed double free

 [ne] avoid OOB read

* [mach0] always ensure there is a trailing zero
2021-08-27 19:51:10 +08:00
Anton Kochkov
f1ef875162 Fix buffer overflow in JAVA 2021-08-23 18:43:49 +08:00
Giovanni
4486dbfb03
Check for null pointer in class_bin.c (#1472)
* Check for null pointer in class_bin.c
* Use continue instead of break
2021-08-18 09:19:45 +08:00
Giovanni
984e9728d3
Various fixes on Java, icc/ic and dex rewrite (#1455)
* rewritten dex parser
* rewritten java demangler
* javas/javac returns demangled comments
* converted code to use new rz_buf_read_le* apis
* Added ownership & doxygen 
* Removed useless dex hack
2021-08-17 21:52:11 +02:00
Alexis Ehret
1c7daaf12e
Modification of rz_buf_read* API (#1440)
* Small cleanup RzBuffer constructors
* Small cleanup RzBuffer methods
* Refactor rz_buf_read* for a better error handling
* Add documentation for RzBuffer API ##doc
2021-08-16 18:23:46 +08:00
GustavoLCR
c9acf440cf
Reorganize map skyline segments 2021-08-03 22:44:38 +08:00
Florian Märkl
49a9817898
Introduce new RzBinMap and refactor all Bin Plugins for it (#1062) 2021-04-22 18:23:30 +08:00
wargio
1d491048c0 Optimized java code (less mem) and added attribute to strings 2021-04-16 18:25:17 +08:00
wargio
c165d39903 Fix Coverity CID 316177 2021-04-15 11:06:37 +02:00
wargio
e7452f50ff Fix Coverity CID 316827 (Integer overflow) 2021-04-15 11:06:37 +02:00
wargio
4cebdb575a Fix Coverity CID 316305 2021-04-15 11:06:37 +02:00
Anton Kochkov
afa3c5e4d2 Fix Coverity CID 317025 (UAF) 2021-04-09 19:46:34 +08:00
Florian Märkl
90509e0595 Give binsyms a name (RzBinSpecialSymbol) and make them RzBinObject-local 2021-04-03 16:24:05 +02:00
Giovanni
037c8be6c3
fixed java slow loop on fuzz bin (#895) 2021-03-23 17:47:17 +01:00
Paul I
de0dad1bd0
Use rz_bin_import_free() as <free> cb for imports list (#893) 2021-03-24 00:21:16 +08:00
Paul I
ef57d79be3
Use rz_bin_symbol_free as <free> method for symbol lists (#888) 2021-03-22 09:24:11 +01:00
Paul I
c1eb90ab4d
Use rz_bin_field_free for releasing RzBinField objects (#881) 2021-03-21 08:49:26 +08:00
Giovanni
606d4ab81b
Java fixes (#875)
* limited spam of errors on fuzzed bins.
* fixed null pointer deref on cbin
2021-03-21 08:30:42 +08:00
wargio
a065846e2d Convert to Error Logs 2021-03-20 12:32:24 +01:00
Giovanni
7cfddb1da8
Java rewrite with LGPL license (#804)
* Rewritten RzBin java plugin (LGPL3)
* Rewritten java_core.c (LGPL3)
* Rewritten java RzAsm plugin (LGPL3)
* Rewritten java RzAnalysis plugin (LGPL3)
* Resolve constant_pool.<index> when rzbin is available.
* Updated tests with proper ones
* Support java <1.0.2 (i.e. OAK) file format
* Added constant pool resolver `javar`
* Added tests from java 1.7 to 15
2021-03-19 22:00:19 +08:00