3946 Commits

Author SHA1 Message Date
Dennis Goodlett
d100777d4c Fix wasm function offset lookup ##bin 2022-06-30 00:09:08 +02:00
Dennis Goodlett
b2567a8eec Split wasm imports by types ##bin 2022-06-30 00:09:08 +02:00
pancake
3db3750eb0
Lint for x"" ##cleanup 2022-06-28 12:07:58 +02:00
pancake
304a3a7fcf
Use more R_LOG instead of eprintfs and add more linting checks ##refactor 2022-06-28 11:24:06 +02:00
Richard Patel
363df75c06
Replace some instances of eprintf with R_LOG_ 2022-06-28 02:49:42 +02:00
condret
fc285cecb8 Fix #20354 2022-06-25 17:08:10 +02:00
pancake
b4ca66f5d4 Fix #20336 - wasm bin parser ##crash 2022-06-21 00:59:47 +02:00
Dennis Goodlett
5aef383592 More format string fixes 2022-06-16 01:41:15 +02:00
Dennis Goodlett
629ad4bf02 Bad format string 2022-06-16 01:41:15 +02:00
Dennis Goodlett
ead6d82efa Better handling of invalid/corrupted wasm files ##bin 2022-06-16 01:41:15 +02:00
Dennis Goodlett
27bc692b91 Use RPVector for wasm imports ##bin 2022-06-16 01:41:15 +02:00
Dennis Goodlett
fdf4fa5e3f Use RPVector for wasm data section ##bin 2022-06-16 01:41:15 +02:00
Dennis Goodlett
a76069c990 Refactor wasm start section parsing ##bin 2022-06-16 01:41:15 +02:00
Dennis Goodlett
693cfca7a6 Move RBinWasmObj-code to RPVector ##bin
This should also fix a couple of sneaky double free crashes that would only
happen on bad files or failure to alloc.
2022-06-16 01:41:15 +02:00
Dennis Goodlett
df397a0109 Wasm use rpvector on elements ##bin 2022-06-16 01:41:15 +02:00
Dennis Goodlett
73be2eaba4 WASM use RBinWasmObj in vector parsing ##bin 2022-06-16 01:41:15 +02:00
pancake
cc6c5747fd
Mark more globals as TLS (#20289) 2022-06-14 12:55:40 +02:00
pancake
040fa86a9f
Fix last covs (#20290) 2022-06-14 12:20:21 +02:00
Dennis Goodlett
48afb759fc Fix wasm iE duplicates ##bin 2022-06-14 09:59:00 +02:00
Dennis Goodlett
f438cabef1 Rename wasm subection index member to sec_i ##bin 2022-06-14 09:59:00 +02:00
Dennis Goodlett
e45c08acbf
Change wasm subsections into RPVectors ##bin
* Use RPVector for wasm tables entries ##bin
* Use RPVector for wasm memmories entries ##bin
* Use RPVector for wasm global entries ##bin
2022-06-13 00:36:57 +02:00
Dennis Goodlett
4015a0d6cc
Refactor wasm and add function section parsing ##bin
* Remove count member from 
Most, but not all, sections start with a vector of data. Vectors start with a
count. The count though should be a part of the section content, not the
section header.

* Remove unsed buf_read_new from wasm parser ##bin
* Refactor wasm vector sub-section parsing ##bin
* Add wasm function sub-section parsering ##bin
2022-06-12 09:51:38 +02:00
Ben Demick
b3d74eb2ca
Fix ELF default arch of x86 ##bin 2022-06-10 00:02:03 +02:00
Richard Patel
71eb5ab818 Improve readability of bin_elf.inc
Co-Authored-By: pancake <pancake@nowsecure.com>
2022-06-09 23:53:56 +02:00
Richard Patel
b4a2914184 Add initial BPF ELF relocs 2022-06-09 23:53:56 +02:00
pancake
f4b2d593d0 Remove trailing spaces and fix two format string warnings in bin.s390 2022-06-09 16:09:48 +02:00
pancake
4c1a4f27e7 Avoid false positives when loading s390 modules ##bin 2022-06-09 14:51:05 +02:00
Dennis Goodlett
825cfa2dac
Refactor wasm function types ##bin 2022-06-09 09:31:26 +02:00
Dennis Goodlett
123b53ffae Wasm allow partial custom name parsing ##bin 2022-06-08 19:20:47 +02:00
Richard Patel
7272cbf894 Set correct CPU in DOL bin loader 2022-06-06 13:49:42 +02:00
pancake
15a3c086e0 Fix #17961 - missing flags in asm.reloff=1 + scr.color=0 ##disasm
* Adds a test
2022-06-05 14:44:56 +02:00
pancake
409eb40169
Initial import of the asm.bpf plugin from extras ##arch
* Supports disassembly, static op analysis and esil
* Assembler is implemented but commented, needs some cleanup
2022-06-03 01:43:03 +02:00
Richard Patel
4162fe8079
Add initial anal.bpf.cs plugin + disasm tests ##arch 2022-06-03 01:35:05 +02:00
Dennis Goodlett
9bf310203a Wasm iE improvment ##bin 2022-06-03 01:09:37 +02:00
pancake
3b0ae93165
Fix last covs from recent changes (v850 spaces/uaf, macho/io nullderefs) 2022-05-31 02:14:16 +02:00
Dennis Goodlett
b0129d7207
Better handling of Wasm Names ##bin 2022-05-31 01:33:45 +02:00
pancake
11b90ea6fd Fix #19976 - Add missing braces in nested struct initialization {{0}}
* Fix warnings on Android builds
2022-05-30 20:18:51 +02:00
pancake
c2f4c7029f Fix large loading times in macho parser for binsz=-1 ##bin
* Reproducer: `r2 -c 's r2f.modulebase;oba $$' frida://0`
2022-05-27 02:12:55 +02:00
pancake
ea087c0ca6 Fix overflow check introduced in 193f4fe01d7f626e2ea937450f2e0c4604420e9d 2022-05-27 01:46:35 +02:00
pancake
193f4fe01d
Fix integer overflow in string search causing oobread ##crash
* Reported by @greatergoodest via huntrdev
* BountyID: 8a3dc5cb-08b3-4807-82b2-77f08c137a04
* Reproducer bfileovf
2022-05-26 17:42:39 +02:00
pancake
3bc07a2d5b Fix last covs 2022-05-24 18:22:35 +02:00
Dennis Goodlett
6bf4f8db06 Fix off-by-one bound check in wasm format ##bin 2022-05-23 12:27:12 +02:00
Dennis Goodlett
71017f10f1 Simplify functions in wasm format ##bin 2022-05-23 12:27:12 +02:00
Dennis Goodlett
dfdff16274 Fix leak in wasm custom names ##bin 2022-05-23 12:27:12 +02:00
Dennis Goodlett
00c972931a Better formating wasm custom name ##bin 2022-05-23 12:27:12 +02:00
pancake
dac4e82cba Fix parsing LE and COFF on big endian host ##bin
* Inspired in xvilka's patch from rizin
* Fix infinite loop in error handling
2022-05-23 00:07:52 +02:00
Anton Kochkov
3d8c2b6391 Fix pyc parsing on big endian machines ##bin 2022-05-23 00:07:52 +02:00
Dennis Goodlett
e258cc6bc0 Fix leak in wasm sections ##bin 2022-05-21 03:56:15 +02:00
pancake
738b9ca5e4 Add bin.maxsymlen to make this symbol name length limit configurable ##bin 2022-05-19 23:03:30 +02:00
pancake
8e4f69a74b Do not accept symbol names in mach0s larger than 2KB ##bin
* Fix memory consumption explossion while parsing corrupted binaries
2022-05-19 23:03:30 +02:00