Commit Graph

20 Commits

Author SHA1 Message Date
pancake
b2f210a0cc
Fix asserts in r2 -a snes foo.sfc ##bin (#17990)
Co-authored-by: pancake <pancake@nopcode.org>
2020-12-04 12:16:09 +08:00
Riccardo Schirone
272265a4c3
Fix ELF R_X86_64_PLT32 relocation entries patching (#17587) ##bin
* Correctly get the address of the PLT entry for a symbol. If the symbol
was not yet added to the .got.r2 section, then take the first available
address (vaddr), otherwise retrieve it from the hashtable.

* Avoid showing wrong relocations when relocations are already replaced
2020-09-08 09:52:35 +02:00
Francesco Tamagni
ee210ed16a Rebase and strip pointers on Mach-O arm64e ##bin
Rebasing and stripping happens on-the-fly by swizzling
the io read function and leveraging the chain starts
generated by supporting the BIND_OPCODE_THREADED
machinery.

For the swizzling to work, all reads generated
during r_bin_object_set_items() must go through the
swizzled read function.

To make this possible, these 3 conditions must be true:
1- r_bin_file_set_obj must be called before the first read
2- the corresponding bin file must be already in the
binfiles list before the first read
3- the swizzled read function must be able to find the
right MACH0_(obj_t) among all active bin objects

This feature is enabled only when opening arm64 binaries.
2020-05-09 16:39:57 +02:00
Marco Grassi
05ee096280
Fix null pointer in bobj.c (#16015)
* fixing memory leaks
* use the return if macro
* removed redundand checks
* fixed some out of bound accesses
* fixed null pointer bug in bobj
2020-02-21 11:05:55 +01:00
Francesco Tamagni
e9c7896154
Parse dyldcache local symbols ##bin (#15980)
Add logic to parse unmapped local symbols.

Every macho image present in the dyldcache has all the metadata about its local symbols stripped away from the corresponding macho header. Instead, this information is present as dyldcache-specific metadata stored in unmapped parts of the cache file.

This PR, for every loaded image, takes care of adding the local symbols which are missing.

Bonus

Fix a potential use-after-free caused by r_bin_object_set_items, by rebuilding class-related hash tables after replacing the class list.
2020-02-16 15:43:31 +01:00
Florian Märkl
00c92a8240
Add user Pointer to RBNodeFree (#15540) 2019-12-04 10:10:33 +01:00
Riccardo Schirone
7594b0f5e6 A bit of refactoring in RBin (#15349)
* introduce r_bin_open_buf
* fix r_bin_file_delete to use bf->id and not fd. This was used
  inconsistently and the function was just wrong.
* rewrite r_bin_reload to just reuse the existing bf->buf
* fix some memory leaks
2019-10-24 14:33:54 +02:00
condret
cbb2389b10 Implement ESIL control-flow-graph and further dfg analysis ##anal
* Implement containing rbtree, give RBTreeComparator a user ptr
* RAnal.ESIL.DFG: handle type, memory, register, relations and filter, reverse
* Add r_anal_esil_cfg_op and use it to merge fcn bbs
2019-09-26 11:36:20 +02:00
Florian Märkl
bacd7c10af Fix named/raw Formats in RBinField (#15055) 2019-09-16 19:35:19 +02:00
pancake
7b8df7f5a2 Fix double-free in bin-relocs 2019-09-09 15:10:38 +02:00
pancake
baa91ca899 Initial working implementation of bin.libs ##bin 2019-07-05 19:03:03 +02:00
radare
15213cde26
More code cleanup in RBin (#14473) 2019-07-03 01:21:41 +02:00
Anton Kochkov
d3909cab84 Fix more grammar 2019-06-18 14:51:30 +08:00
pancake
30cee7811e Rename r_bin_file_set_cur_binfile_obj to r_bin_file_set_obj 2019-06-16 23:35:12 +02:00
radare
d06a77d731
Get rid of the ELF-specific C++ detection ##bin (#14285) 2019-06-16 18:36:33 +02:00
radare
081bec11e0
A couple of fixes for base address support ##bin 2019-06-10 11:25:34 +02:00
pancake
acb0590edd Fix asserts and memleak in RBin.classses 2019-06-09 01:19:49 +02:00
pancake
094ece7e36 Fix class initialization and simplify some paths (-10LOC) 2019-06-07 14:06:37 +02:00
pancake
60421a51c8 More RBin refactoring and cleanup 2019-06-07 13:53:14 +02:00
pancake
7db9c29805 More code cleanup in RBin, speedup method resolution ##performance 2019-06-07 03:50:22 +02:00