Commit Graph

2793 Commits

Author SHA1 Message Date
Riccardo Schirone
8344b7c304
Rename new json parser file to json_indent to avoid collisions (#17569) ##build
libr.a is built with all the files required to build against r2, so that
includes also SDB. As SDB already has a file named json.c, the new json
parser in r_util collides with it.
2020-09-02 04:56:54 +02:00
David CARLIER
46874bae17
Fixes r_sys_pid_to_path for Haiku using proper team_id/pid_t ##util (#17571) 2020-09-02 04:55:56 +02:00
Anton Kochkov
14bc6586fc Fixes for <=glibc-2.2 versions 2020-08-28 23:04:39 +08:00
Khairul Azhar Kasmiran
4bc96b847a
Fix MS-DOS fuzz tests (#17496) 2020-08-20 12:17:13 +08:00
HoundThe
5845ec39ca
Add function information from DWARF ##anal ##bin (#17434) 2020-08-19 18:21:20 +08:00
pancake
e22b3e9bcc
Fix race condition and remove unnecessary SDB build targets ##build (#17476)
* Simplify sdb build
* This was wrong
* updadte sdb
Co-authored-by: pancake <pancake@nopcode.org>
2020-08-19 10:31:20 +02:00
abcSup
528e79818f Undo changes that modify signals in threads 2020-08-18 12:23:30 +08:00
abcSup
ab70092664 Improve support for debugging multihreaded processes on Linux ##debug 2020-08-18 12:23:30 +08:00
Anton Kochkov
e3504eb0d9
Some DragonFlyBSD build fixes ##port (#17470) 2020-08-17 12:43:10 +08:00
phakeobj
1dca25c084
Fix null dereference in Pe64_bin_pe_compute_authentihash ##bin (#17466)
* Fail if ASN1 object is not ObjectID
* Fail if CMS contentType is NULL
* Fail if SpcAttributeTypeAndOptionalValue type is NULL
* Fail if cms contentType is not spcIndirectDataContext
* Use strcmp and r_return_val_if_fail
* Assert only on function arguments, not their contents

Co-authored-by: phakeobj <phakeobj@users.noreply.github.com>
2020-08-17 12:36:05 +08:00
Florian Märkl
3ef9c81da9
Add the r_json json parser based on nxjson ##util (#17439) 2020-08-14 20:57:09 +02:00
pancake
8efd721dba
Fix Cydia/iOS packaging and compilation issues ##build (#17342) 2020-08-14 13:17:32 +08:00
GustavoLCR
bb3e80c040
Implement pde to disassemble following code execution ##disasm (#17410)
* Implement `pde` to disassemble following code execution
* Fix `asm.filter=1` with `scr.color=0`
* Fix cache not being used
* Share read and write file permissions on Windows
* Use CreateFileW in r_sandbox_open on Windows and fix file permissions
* Fix opening nul and O_RDWR
* File creation flags cannot be combined on Windows
* Share write in r_file_mmap_windows
2020-08-13 10:05:38 +08:00
Florian Märkl
68a1db448d
Merge everything time-related in r_time.h (#17445) 2020-08-12 18:54:49 +02:00
Florian Märkl
8c94f34e90
Add r_sys_now_mono() and use in r2r ##util (#17276) 2020-08-11 20:26:06 +02:00
NIRMAL MANOJ C
b4677b4dfe
Add Function Name, Constants, Globals and Local Variables to RAnnotatedCode (#17429)
* Annotation for function name (#17204)
* Annotations for Constant Variables and Global Variables for the decompiler (#17281)
* Annotation For Function Variables (#17375)
* function variable annotation added (includes local variable and function parameter)
* API for checking if an annotation is a reference or function variable. (#17386)
* Update docs in annotate code API  (#17397)
* Unit tests for annotated code API (#17403)
2020-08-10 13:40:16 +03:00
Anton Kochkov
b0e3d0c4f9
mkstemps() is available only since glibc 2.19 (#17415) 2020-08-07 21:07:48 +08:00
pancake
340c006db8
Fix #17322 - Honor bin.baddr from idp to load rebased PDB files ##bin (#17321)
Co-authored-by: pancake <pancake@nopcode.org>
2020-08-07 17:25:56 +08:00
HoundThe
b44b8cb405
Add acg - printing class hierarchy graph ##anal (#17362)
* add `acg` - printing class hierarchy graph
* Move the printing into the cmd_anal.c from returned RAGraph
* Change API to return Graph and transform it to AGraph when printing is necessary
* Move graph to agraph into agraph module, move generic node structure to rgraph, removing unnecessary dependency
* Move RGraphNodeInfo related functions to graph.c
2020-08-07 17:23:52 +08:00
David CARLIER
ff89101dec
Solaris/Illumos sandbox support ##port (#17407)
Use priv api to remove few privileges to the current process.
2020-08-07 13:01:14 +08:00
Riccardo Schirone
154416c8fd
Add unit tests for binheap (#17367) 2020-07-31 18:09:50 +08:00
Khairul Azhar Kasmiran
1c093249c8
Windows r_sys_perror: Don't add end newline if an end newline already exists (#17380) 2020-07-31 15:09:02 +08:00
Khairul Azhar Kasmiran
fca4fa6180
Windows r_sys_perror: Add error code to string (#17374) 2020-07-30 12:33:00 +08:00
pancake
61a3595e4f
Implement pfQ to print/format 128bit unsigned values ##print (#17310) 2020-07-24 11:53:13 +02:00
Zi Fan
ac126508d5
Fix debugger to run debuggee with original environment variables ##debug (#17116)
* Change `fork_and_ptraceme` to start debuggee with rarun2 profile on Linux & Mac
* Add two new commands `doe` and `doe!` to show and edit rarun2 startup profile
* Fix `r_run_parse` to read last line
2020-07-24 16:25:55 +08:00
Dennis Goodlett
46ac728d7a
Fix Levenstein distance on empty buffers ##radiff2 (#17330) 2020-07-23 09:52:31 +02:00
pancake
d441baad62
Fix latest COVs, remove dead code and unnecessary global variables (#17231)
Co-authored-by: pancake <pancake@nopcode.org>
2020-07-22 19:37:31 +08:00
Riccardo Schirone
2d160f2509
Avoid sdb double headers (#17249) ##build
* Avoid duplication of SDB headers in libr/include

SDB is an external project and as such it should live in shlr. However,
for simplicity in dealing with the include flags, the SDB headers were
copied in libr/include as well. This patch just keeps the SDB files
confined in shlr/sdb and make sure various r_* libs use the headers from
there.

* Fix pkgconfig file generation
2020-07-21 10:28:43 +02:00
Khairul Azhar Kasmiran
5dd63b77fb
Fix udiff.c clang warnings (#17320) 2020-07-21 11:58:26 +08:00
David CARLIER
d30ca79e2d
Backtrace support for haiku ##port (#17317)
backtrace is available but not as system library but third party package.
2020-07-20 19:40:28 +08:00
pancake
c06d82eb9b
Fix #17229 - Refactor function that exports bin info add tests and fix segfault (#17232) ##bin 2020-07-20 12:18:38 +02:00
Khairul Azhar Kasmiran
d970c64292
Move r2r diffchar code into r_util (#17316) 2020-07-20 00:44:27 +08:00
David CARLIER
320c001c4c
CPU affinity and backtrace upport or SunOS ##port (#17288)
* Backtrace is supported w/o external lib.
* Thread affinity implementation.
2020-07-17 08:07:18 +08:00
Riccardo Schirone
594b940b7c
Fixes some of the issues in Travis (#17267)
* Do not check with r_return_ if the convention is present

Let's just assume the NULL default in such a case, so that architectures
for which we don't have a defined calling convention can still be
processed somehow by the analysis code. It won't be precise, but it's
better than nothing.

Also add a warning message so users are aware when the calling
convention is not defined.

* Fix oob-read when # is at the end of the cmd string

* Do not set TMPDIR when the new value is the empty string

When TMPDIR is set to empty value, clang+ld behaves in weird ways and
you cannot compile files from within the r2 shell (e.g. when using #!c
or #!cpipe)

* Use meson and add -lasan to pkgconfig files when sanitizer are used
2020-07-16 20:47:30 +08:00
Riccardo Schirone
3e6fe7156d
Fix infinite loop regression in Linux debugger by using ferror in addition to feof() ##debug (#17259)
* Check for ferror(), not only for feof()

Some files could not be read and would create an infinite loop during
the execution of r_file_slurp. This patch fixes that issue: when an
error occur at read time, it detects it with ferror(fd) and it returns
an empty buffer.

* Call ferror inside loop and fclose fd
2020-07-15 09:16:59 +08:00
David CARLIER
9927764dff
Solaris/Illumos support thread name api as linux ##thread (#17272) 2020-07-14 12:10:40 +08:00
Riccardo Schirone
f8cafe4f2f
Update spp to 1.2.0 (#17243)
* Update spp to 1.2.0
* Make sure to use USE_R2=1 when compiling spp
2020-07-09 17:20:06 +08:00
Giovanni
d7ddba55b4
Various fixes based on fuzz bins for rabin2 (#17199)
* div by 0

* null deref in r_bin_dex_free

* null deref in get_object

* memset to 0 new capacity if we increase, to avoid garbage in the vector.

* null deref in extract_sections_symbols

* printfs. and moved insert after null deref check.

* moved check before adding the cobj into list.

* moved i definition inside if.

* using r2 macros.

* changed condition to sym_size == 0

* changed condition to if (ret) do smth

* refactoring

* code formatting

* added r_pvector_new_with_len to fix issue with bad usage of RPVector

* using r_pvector_new instead DUP

* Removed check which doesn't make sense and formatting

Co-authored-by: Giovanni Dante Grazioli <giovanni.dantegrazioli@nbs-system.com>
2020-07-06 20:19:25 +08:00
Riccardo Schirone
d6c9bd4542
Add support for binr/blob and fix android build ##meson ##build (#17150)
* Make sure meson can build with `system` = `android`.

* Add support for binr/blob in meson build

* Add also r_util as dependency

* Create sdb_version.py to get the SDBVER value from config.mk

* Set unknown sdb version if something fails
2020-07-05 10:53:37 +08:00
pancake
f4174c020f
Fix two shift overflow causing undefined behaviour (#17160)
Spotted in clusterfuzz-testcase-minimized-ia_fuzz-6301506113634304
2020-07-03 18:43:00 +02:00
pancake
27a625065a
Fix #16781 - Add --without-dylink configure flag to disable libdl features ##build (#17173)
* Add `--without-dylink` configure flag to disable "libdl" features
* Add "WANT_DYLINK" option in Meson buildsystem

Co-authored-by: pancake <pancake@nopcode.org>
2020-07-02 11:58:12 +08:00
pancake
13e1636d97
Implement RLang.spp for templated scripting ##lang (#17067)
Co-authored-by: pancake <pancake@nopcode.org>
2020-07-01 14:14:18 +02:00
pancake
d47aed440a
Fix covs from 2020-06-29 (#17184)
* Fix covs from 2020-06-29

* CIDs: 1293553 1408695 1430058 1430059 1430060
1430061 1430062 1430063 1430064 1430065 1430067

* More fixes

Co-authored-by: pancake <pancake@nopcode.org>
2020-07-01 09:33:38 +08:00
pancake
3acbe60fde
Implement rafind2 -F to find the contents of the file ##search (#17143) 2020-06-29 20:11:34 +02:00
pancake
c706d0b69f
Improve code quality of file and sandbox ##util (#17136)
* Improve code quality of file and sandbox ##util
* Use `r_return_*`
* Read procfiles once

Co-authored-by: pancake <pancake@nopcode.org>
2020-06-29 13:23:02 +08:00
David CARLIER
f56ae25d35
Haiku OS - implement io_self ##libr (#17164)
Update debug thread wrapper and implement basic io_self plugin
2020-06-29 13:06:07 +08:00
Florian Märkl
6f424070dd
Fix #16730 - Add bounds check to r_vector_insert ##util (#17142) 2020-06-27 21:49:52 +02:00
David CARLIER
4d22e92d6d
Haiku build fix proposal (#17117) ##sys 2020-06-27 17:20:43 +02:00
pancake
e56c784791
Optimize r_file_proc_size() reading by blocks instead of chars ##util (#17119)
* Optimize r_file_proc_size() reading by blocks instead of chars ##util

For /proc/self/maps this is almost 2x faster, will be much faster on bigger files

* Make it static, it's not even defined in r_file.h
* Rename `r_file_proc_size()` into `procfile_size()`

Co-authored-by: pancake <pancake@nopcode.org>
Co-authored-by: Anton Kochkov <xvilka@gmail.com>
2020-06-23 13:25:14 +08:00
Fangrui Song
3380e7c9da
r_file_slurp: don't choke on an empty file (#17118)
If `0` is an empty file:

% radiff 0 1
radiff2: Cannot open 0

This patch fixes it.
2020-06-22 12:15:33 +08:00