Commit graph

21 commits

Author SHA1 Message Date
wargio
b35d3ea195 Fix #3032 - Fix oob read in dwarf_process.c 2022-09-17 18:37:54 +02: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
wargio
f674aecd20 fix #2971 - null deref dwarf_process.c 2022-08-24 08:26:37 +08:00
wingdeans
a6a7a5f530 Fix annotation inconsistencies 2022-08-03 00:29:56 -04:00
Anton Kochkov
2188b4564d
Various Coverity fixes (#2615)
* Fix CID 392733 - memory leak

* Fix CID 392732 - memory leak

* Fix CID 392730 - memory leak

* Fix CID 392729 - memory leak

* Fix `rz_analysis_diff_free()` API function

* Fix CID 392685 - memory leak

* Fix CID 392012 - use after free

* Fix CID 391968 - uninitialized pointer read

* Fix CID 391966 - memory leak

* Fix CID 391964 - uninitialized pointer read

* Fix CID 390013 - memory leak

* Fix CID 389939 - memory leak

* Fix CID 379249 - memory leak

* Fix CID 378881 - uninitialized scalar variable

* Fix CID 378973 - uninitialized scalar variable

* Fix CID 378850 - uninitialized scalar variable

* Fix CID 371079 - memory leak

* Fix CID 367478 - memory leak

* Fix CID 366821 - memory leak

* Fix CID 366736 - memory leak

* Fix CID 361684 - uninitialized scalar value

* Fix CID 352581 - memory leak

* Fix CID 352557 - memory leak

* Fix CID 348937 - memory leak

* Fix CID 322229 - memory leak

* Fix CID 320122 - memory leak

* Fix CID 317611 - memory leak
2022-05-15 23:15:28 +08:00
Dhruv Maroo
114631f666
Check kind of DWARF attribute before demangling (#2099)
* Check kind of DWARF attribute before setting `fcn` members

* Add parameter documentation for `rz_bin_demangle`
2021-12-14 10:17:33 +08:00
Anton Kochkov
74bf3d8902
Various memory leaks (#1902)
* Fix CID 358531
* Fix CID 322803
* Fix CID 322786
* Fix CID 322126
* Fix CID 316868
* Fix CID 316734
* Fix CID 316713
* Fix CID 316522
* Fix CID 316490
* Fix CID 316468
* Fix CID 316361
2021-10-29 17:18:16 +08:00
Riccardo Schirone
c077653575 Check for NULL in dwarf_process:prefer_linkage_name 2021-09-02 14:44:13 +02:00
Anton Kochkov
8b7822bd58
Fix some of the Coverity reports (#1501)
* Fix CID 355574
* Fix CID 355087
* Fix CID 354877
* Fix CID 354875
* Fix CID 354868
* Fix CID 354874
* Fix CID 354666
* Fix CID 354864
* Fix CID 354665
* Fix CID 354646
* Fix CID 352578
* Fix CID 352571
* Fix CID 352553
* Fix CID 352501
* Fix CID 352494
2021-08-23 18:38:37 +08:00
Anton Kochkov
3c59df7e98
Refactor RzTypes to use structs instead of SDB + New Tree-Sitter based C Parser (#1047)
- Removed oldshell version of `t` (types) commands
- Removed `tk` command because types storage switched to the hashtable
- Added `tfc` command to show the calling convention of the function or set it
- Added `tsl` (RZ_OUTPUT_MODE_LONG) to show structure members' sizes and offsets
- Added `tul` (RZ_OUTPUT_MODE_LONG) to show union members' sizes
- Switched the types storage to the hashtable instead of SDB
- Added load and export from/to SDB for standard type libraries and serialization for Projects
- Changed all `char *type` occurences to the proper `RzType`
- Added `RzCallable` type for the function/class method types
- Changed all function types API to use the `RzCallable` API
- Switched the function types (`RzCallable`) storage to the hashtable instead of SDB
- Added a connection between `RzAnalysisFunction` and `RzCallable` - `rz_analysis_function_derive_type()` API function to derive new `RzCallable` type from the `RzAnalysisFunction` even if it doesn't exist in the RzTypeDB.
- Moved type links to the RzAnalysis where they belong
- Removed TCC and MPC-based parsers
- Added Tree-Sitter-based parser for C grammar (see `librz/type/parser/*`)
- Reworked type databases in `librz/analysis/d/` to be consistent with C standard, libc, platform-specific definitions
- Switched the type links from `char *` to `RzType`
- Switched the type links from SDB to the hashtable
- Added concept of the "type paths", e.g. `a.b[20].c` where `b` is a member of `a` (`a` is either structure or a union) and `c` is a member of `b`, and `b` is an array where we take 20-th element.
- Added concept of the typeclasses (a bit similar to Haskell) for numerical types: `None` (the most generic one), `Num` (includes `Integral` and `Floating`), `Integral` (includes `Signed Integral` and `Unsigned Integral`), `Floating`.
- Added concept of type equality (`rz_types_equal(a, b)` API function)
- Added Doxygen documentation to every API function in the `librz/type/*`.
- Updated the project format from **V2** to **V3**, added migration.
2021-07-20 01:46:45 +08:00
Basstorm
5f27ed6300
Add missing registers for dwarf reg mapping in x86 (#1151) 2021-05-19 19:34:46 +02:00
Anton Kochkov
788fdb3d8e
Extracting types handling into RzType (librz/type) ##refactor (#896)
* RzType introduction
* Move format processing to RzTypes from RzUtil
* Rename RzType to RzTypeDB
* Join RzType and RzAnalysis noreturn functions
* Add noreturn column in `aflt` output
* Remove D (disassembly) pf tests
* Fix `tn` test
* Add function noreturn serialization
* Modify meaningless type test
* Fix wrongly written `Cf` test
* Fix `za t` (zignature type) command
* Fix signature type test
2021-04-06 18:04:00 +08:00
Florian Märkl
5b95327c17 Prevent infinite Recursion in Dwarf Types Parsing 2021-04-05 12:00:24 +02:00
Florian Märkl
f28f6e80eb Add some missing DW_AT_KIND_STRING checks 2021-04-05 12:00:24 +02:00
Riccardo Schirone
53bf5c497f SPDX Copyright text for all files based on history
- Add LICENSES directory
- Download additional licenses used
- Add .reuse directory
- Add doc about SPDX/reuse

Co-authored-by: Florian Märkl <info@florianmaerkl.de>
2021-03-05 19:39:15 +08:00
Alexis Ehret
d9d75731d2 Fix memory leak librz/analysis/dwarf_process.c 2021-02-24 20:52:16 +01:00
ChD1
0e97b00ae2 Fix memory leaks and small logic bugs (#18297) 2021-02-03 19:27:30 +08:00
Anton Kochkov
a0be4e2e64 Run clang-format 2021-01-21 22:05:44 +08:00
Alexis Ehret
fe73c1af16
Remove all dead assignment detect by clang sa (#310) 2021-01-07 10:00:02 +01:00
Anton Kochkov
ad36954adb
More renames of *anal* to *analysis* (#123) 2020-12-07 13:20:29 +01:00
Anton Kochkov
041d73dce3
Change the "anal" abbreviation to "Analysis" in Code (#117) 2020-12-06 19:25:27 +01:00
Renamed from librz/anal/dwarf_process.c (Browse further)