Commit graph

23 commits

Author SHA1 Message Date
Khairul Azhar Kasmiran
c1fc1419e4
Rename some rz_list funcs to rz_list_XXX_val (part 1) (#5671)
* Rename rz_list_find_ptr() to rz_list_find_val()
* Rename rz_list_delete_data() to rz_list_delete_val()
2025-12-25 22:01:49 +08:00
Rot127
092dc95446
Fix reading from cache in rz_io_nread_at(). (#5618)
The cache read must read within the mapped region and not beyond.
Otherwise it would go against the documentation of rz_io_nread_at().
rz_io_cache_read() internally doesn't know about map boundaries so
the length parameter passed to it in rz_io_nread_at()
should only read 'ret' number of bytes.

To give somewhat more introspective what rz_io_cache_read() does,
the return value meaning was changed to success/failure
and an out parameter was added to get the number of bytes read.
2025-12-16 03:00:09 +08:00
Florian Märkl
93dd35f6db
librz/core: Fix disassembly (e.g. pd) with unmapped gaps (#4932)
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.
2025-02-26 22:59:44 +08:00
Riccardo Schirone
c9d6ad9ee6
io: return error when reading/writing to unmapped memory (#3323)
* core: 'wow' command was replaced with 'wb'

* io: on_map_skyline returns false when nothing was done

Before this patch on_map_skyline returned true even when the callback
was not called on any part of the skyline. In other words,
reading/writing to an unmapped memory returned true.

This commit changes the behaviour to return false in those cases.

* analysis/esil: mem_read/mem_write were alway returning true

* use o malloc instead of oC

* librz: deal with seek errors
2023-02-11 11:36:27 +01:00
Florian Märkl
88ec019514
Store back-references to core files in RzIOMap (#2408)
This allows tracing an io map back to the RzCoreFile and thus also its
bin file and other info. This is used in rz-ghidra to determine which
memory ranges can be considered readonly to enable constant propagation.
2022-03-14 10:09:14 +01:00
Dhruv Maroo
34d345d884 Format according to clang-format-13 2021-11-25 15:44:28 +08:00
Riccardo Schirone
75fc447873
Fix some memleaks in unit tests (#1869)
* Cleanup RzAnalysisRzil when freeing RzAnalysis

* Fix str leaking in rz_core_write_string_at

* Fix buf leaking in rz_core_yank_paste

* Fix memleak in json unit tests

* Fix features leaking in RzBinInfo

* Fix features leaking in RzAsm

* Fix memleaks in RzTable

* Fix test_str_search memleaks

* Fix memleak in test_io.c

* Fix memleaks in RzBuf and test_buf.c

* Fix memleaks in test_cmd.c

* Fix memleaks in test_config.c

* Fix memleaks in RzCons

* Fix hashes leaking in test_bin.c

* Fix memleaks in test_id_storage.c

* Fix memleaks in test_il*.c and adjust APIs
2021-10-22 09:33:20 +08:00
GustavoLCR
cfc504e1e9
Fix #1506 - Fix unsigned integer overflow in RzIO cache skyline (#1512)
* Fix #1506 - Fix unsigned integer overflow in RzIO cache skyline
* Add overflow check to `RzSkyline` APIs
2021-08-25 16:36:20 +08:00
Florian Märkl
fdc5a414f1 Add Tests to Fix 2021-05-08 13:04:10 +02:00
Florian Märkl
6ed6e1cc93 Add Events for RzIODesc Close and RzIOMap Delete 2021-05-01 20:41:29 +02:00
Anton Kochkov
16602984d9 New API to get vector of RzIO maps 2021-04-16 17:35:51 +08:00
Florian Märkl
a4f623ba25
Add RzIOMap return to rz_io_open_at() (#1012) 2021-04-14 20:41:05 +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
Anton Kochkov
a0be4e2e64 Run clang-format 2021-01-21 22:05:44 +08:00
Khairul Azhar Kasmiran
d5601cc2fe
Replace naked rz_sys_system/write/read/freopen calls with their wrapped counterparts (#388) 2021-01-19 00:07:19 +08:00
Liumeo
0b0b521c8c Fix memleak in test_analysis_block & test_io (#18153) 2021-01-05 05:21:41 -06:00
Riccardo Schirone
7316b71619 Simplify io_default with RzBuffer 2021-01-03 11:42:38 +01:00
Riccardo Schirone
a7fd3fa3c6 Use mu_main to reduce boilerplate in unit tests
* Disable colors on Windows because terminal looks bad otherwise
* Use environment on Windows to set PATH and make sure unit tests use
  the compiled libraries and not the installed ones
* Define ssize_t on Windows as well by using SSIZE_T

Update test_analysis_block.c

Update test_intervaltree.c

Update test_unum.c
2021-01-03 11:42:38 +01:00
GustavoLCR
e62aa35db6 Optimize io.cache ##io (#17952)
* Add RSkyline ##util
* Add `r_vector_len()`
* Optimize io.cache ##io
* Use RSkyline instead of RList
* Add cache skyline for faster reads
* Use PJ API in `wcj`
* Add test and fix
2020-11-24 14:51:44 +01:00
Riccardo Schirone
502e91aff7
Rename R_ and R2_ to RZ_ (#8)
* Rename R2_ -> RZ_
* Rename R_ -> RZ_
* Rename R2R_ -> RZ_TEST_
* Rename R2R defines and types to RZ_TEST/RzTest
* Keep R_ for REIL registers
2020-10-02 16:09:13 +02:00
Riccardo Schirone
721609a17b
Rename to rizin (#2) 2020-10-01 16:13:03 +02:00
GustavoLCR
cef191cde3
Fix #14024 - Make r_io_map_get() faster (#17324) ##io
* Fix O(n) in r_io_map_get() ##io
* Kill `map_skyline_shadow` and `do_skyline`
2020-07-31 10:04:57 +02:00
Florian Märkl
ae61aa8e37
Imports Tests from radare2-regressions (#15546) 2019-12-08 15:31:14 +01:00