Commit graph

32 commits

Author SHA1 Message Date
Khairul Azhar Kasmiran
c8878d3139
Convert %ll format specifiers to PFMT64 (#6267)
* Convert `%ll` format specifiers to PFMT64
* Remove ` ""` at end of some PFMT64
2026-04-22 05:57:04 +08:00
Rot127
08acf54585
RzBuffer consistency and make buffer type public (#4666)
* Make rz_buf_read consistent.

The IO buffer did not updated its seek after reading. Although most of the others do.
The behavior is now documented.

* Partially reverse seek on read for IO_FD and FILE buffers. Because it breaks too many tests.

* Add type when initializing RzBuffer.

* Remove duplicate documentation of RzBuffer read()
2024-10-12 11:27:21 +02:00
pelijah
d43bb152df
buf_format(): parse format string only once (#4365) 2024-03-17 10:18:56 +08:00
Florian Märkl
54640cb01c Fix rz_buf_read_at() after negative addr
rz_buf_read_at() with a negative addr on a ref (slice) buffer broke all
subsequent calls to rz_buf_read_at(). This is fixed by making sure to
always reset to the initial seek.
This bug was detected through xnu kernelcaches, where we may also skip
any obviously invalid read.
2023-07-01 22:28:28 +08:00
GustavoLCR
71e12433ac
Fix rz_buf_fwd_scan unit test for big endian archs (#2589) 2022-05-05 12:39:25 +08:00
GustavoLCR
55fc4dfac1
Implement new rz_buf_fwd_scan() API (#2530) 2022-04-17 15:08:08 +02:00
Florian Märkl
86a7439519
Add IO/Map-based RzBuffer Implementation (#2147)
This adds an RzBuffer implementation that binds against RzIO's
rz_io_read_at/rz_io_write_at in order to access the mapped memory. This
is in contrast to the previous io RzBuffer, which has been renamed to
..._io_fd and which reads directly from a single file descriptor without
mapping.
To keep bf working, bin_bf now maps an area of zeroes because
otherwise the initial memory contents in RzIL would read as 0xff.
2021-12-29 10:28:55 +01: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
Florian Märkl
cf7842e248 Fix sparse buffer size 2021-09-26 10:45:40 +02:00
Riccardo Schirone
ff2c350361
librz/util: Fix double free in buf when whole_buf is not allocated (#1362)
Inspired by
6fb0ba39ed

Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
2021-07-27 12:52:42 +08:00
Alexis Ehret
8e61ef212e Add function rz_buf_get_nstring 2021-07-07 12:01:17 +02:00
Florian Märkl
a019616afd Add rz_buf_new_with_methods() 2021-05-30 10:53:13 +02:00
Florian Märkl
8e97bf218f Replace rz_buf_new() by rz_buf_new_with_bytes(NULL, 0) 2021-05-30 10:53:13 +02:00
Florian Märkl
89b0738ce0 Add rz_buf_sparse_populated_in() 2021-05-17 17:23:19 +08:00
Florian Märkl
63410b43df
Add Overlay Functionality to Sparse RzBuffer (#1124) 2021-05-12 12:52:46 +02:00
Florian Märkl
de8767938f Rewrite Sparse RzBuffer for Efficient Reading 2021-05-11 09:53:51 +02: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
d50d0a43a9 Fix memleak in test_buf & test_cmd (#18162) 2021-01-05 05:21:41 -06:00
Riccardo Schirone
0cf9979f42 Add fd to RzBuf and add mode to mmap RzBuf 2021-01-03 11:42:38 +01:00
Anton Kochkov
1d453a073b Rename test_r_* to test_rz_* 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
Anton Kochkov
7ee14fb853 More renames 2020-11-12 12:27:04 +08: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
Riccardo Schirone
58e5aa0887
Enable unit tests compilation by default in meson (#16990)
Including Fixes for Windows
2020-06-04 12:14:15 +02:00
Florian Märkl
0eb98d24be
Fix all Warnings for GCC 9 (#16223) 2020-03-17 13:31:28 +01:00
radare
2b15e7421e
Many improvements in the V testsuite (#15722) ##test
* Kill some more tests using <<RUN
* Improve r2r.v quite a lot up to 0.2
* Delete stale temporal files in the unit test
* Use executable path instead of dbpath and more cleanup
* Move manpage and move old bins into the attic
2019-12-29 19:26:15 +01:00
Riccardo Schirone
2a676b5f62 Function r_anal_cc_arg should just return NULL when nothing is available (#15646)
* Function r_anal_cc_arg should just return NULL when nothing is available

Callers should be able to handle NULLs

* Fix memory leaks in unit tests
2019-12-16 08:56:40 -06:00
Florian Märkl
ae61aa8e37
Imports Tests from radare2-regressions (#15546) 2019-12-08 15:31:14 +01:00