2782 Commits

Author SHA1 Message Date
pancake
1f172eca0c Prefer c++ over cxx 2018-10-01 16:23:34 +02:00
David CARLIER
046d840520 Refactor cpp symbols detection. (#11699) 2018-10-01 09:32:38 -04:00
Riccardo Schirone
d57b7423af
format/elf: fix is_in_pphdr function (fix #11377) (#11683)
* format/elf: fix is_in_pphdr function

That function should check if an address is in the file "side" of the
phdr, so it should check for filesz and not memsz

* format/elf: consider filesz even when looking at virtual space

A virtual address that is included in p_memsz but not in p_filesz, means
that it's an address that has no counterpart in the physical file, does
it makes no sense to look at memsz when converting an address from
virtual to physical.

* bin/demangle: demangle names that end with @@CXXABI

After last commit, we get correct mangled names that, according to other
tools, include also the @@CXXABI part. This patch removes the @@CXXABI
suffix because the cplus_demangle_v3 function is not able to deal with
it.
2018-10-01 10:47:52 +02:00
Riccardo Schirone
354a40836a Revert "format/elf: fix v2p/p2v in relocs"
This reverts commit ecb8a9d769703b1fa2e5876d5b365bdfc8772a4c.
2018-09-28 15:23:52 +02:00
Riccardo Schirone
ecb8a9d769 format/elf: fix v2p/p2v in relocs 2018-09-28 15:16:04 +02:00
David CARLIER
35d916490f Distinguish C/C++ (#11662)
More based on presence of mangled naming.
2018-09-26 09:21:40 -07:00
Michael Scherer
878e5de408 Add support for token information from minidump (#11582) 2018-09-25 09:58:15 -07:00
pancake
41ec949204 Fix #11112 - Rename {srwx,flags,perms} to perm. (-21 LOC)
Unify R_IO, R_BIN, R_BP, .. into R_PERM_* using 1 letter syntax
2018-09-22 11:31:45 +02:00
Maijin
2197e24594 Fix #11590 - set pydata section to is_data=false 2018-09-20 23:52:36 +02:00
radare
789617b6ad
Implement pFaq to output "quiet" ASN1 format (#11597) 2018-09-20 19:16:33 +02:00
Francesco Tamagni
a2cbe7ebec Fix - don’t assume ELF (arm) main address is physical (#11576)
* Fix - don’t assume ELF (arm) main address is physical

* Remove wrong check
2018-09-19 11:34:39 +02:00
Michael Scherer
533da13065 Fix #11554, by checking the return code of r_bin_mdmp_init_directory_entry (#11565)
And do not return false on mdmp stream type we do not handle yet,
since this is neither future-proof nor what the norm
recommend, cf https://docs.microsoft.com/fr-fr/windows/desktop/api/minidumpapiset/ne-minidumpapiset-_minidump_stream_type
2018-09-19 10:35:55 +08:00
Michael Scherer
90c541c855 Set mdmp sections as readable by default (#11579)
MDMP format store permissions of the memory in a specific stream,
but it seems to be absent by default. So we should at least assume
that the memory is readable unless explicitely specified otherwise
by the dump.

Fix #10992
2018-09-18 23:05:57 +02:00
Khairul Azhar Kasmiran
3841d41505 r_bin_elf_p2v/v2p_new: return UT64_MAX on error + is: show ---------- for paddr if symbol's value is not vaddr (#11513) 2018-09-18 11:43:08 +02:00
pancake
d34ada1a05 Minor fixes for mach0 signature parsing, fix crash in ae? and other null derefs 2018-09-18 11:06:00 +02:00
radare
d901a44df3
Fix unaligned number parsing from memory in dwarf (#11556)
- Spotted with ASAN="undefined" sys/asan.sh
2018-09-17 14:06:36 +02:00
radare
486c61529c
Implement the "underscore command" 2018-09-16 22:50:56 +02:00
pancake
405cddffca Fix memleak, check off/len boundaries and return code from bufRead() 2018-09-16 21:08:52 +02:00
pancake
4410e26070 Implement Computed CDHash for mach0 binaries 2018-09-16 21:05:51 +02:00
Paul I
bf29250ddd Fix #11487 (#11534) 2018-09-15 22:52:12 +02:00
Dimitris Karagkasidis
e238026086 Fix #11399 Use-after-free and a memory leak in handling of WASM binaries (#11533)
* Fix issue #11399: use-after-free in symbols()

Commit 7e083b57f introduced the issue #11399. The list referenced by
`codes` in entries(), is the same list that bf->g_codes is pointing at.
By freeing it, we introduce a use-after-free condition in a later call
to symbols(), where we try to iterate over the list that bf->g_codes
was supposed to be referencing.

* Fix memleak during loading of WASM binaries

A memory leak is reported by ASAN when handling WASM binaries. It is
caused by multiple allocations of RBinInfo structure. First, RBinInfo
is allocated within a call to size() from r_bin_object_set_items(). Then
there is another, explicit allocation of an RBinInfo structure through
a call to the info() callback of the WASM RBinPlugin. This causes loss
of reference to the initial structure, and subsequently a leak.

There are no apparent uses of RBinInfo structure inbetween these two
points, and the size() result is in no way dependent on this structure,
therefore I resolved the memory leak issue by removing the allocation
from within the size() function.
2018-09-15 22:51:38 +02:00
David CARLIER
fc2d054505 Fix golang binaries support. (#11525)
Spotted with go_stripped t/case
2018-09-15 13:53:08 +08:00
fcasal
0ad81b1a7f Detect golang by looking at golang sections. (#11520) 2018-09-14 14:54:00 +02:00
David CARLIER
7ecbaafed3 Little update for sanitizer detection for ELF (#11521)
Spotted with FreeBSD and asan/tsan.
2018-09-14 13:00:40 +02:00
pancake
d521843ae7 Use RStrBuf in pkcs/x509/asn1 APIs, use RCons from RCore to print that 2018-09-14 10:29:49 +02:00
Giovanni
899719389f ASN.1 BER support, with pF[apx] (#11517) 2018-09-14 01:44:04 +02:00
David CARLIER
c64fb327e7 Detect binaries compilers with sanitizers (#11479) 2018-09-13 12:11:09 +02:00
pancake
885f9efeb0 Fix last covs and add $e{} in RNumCallback 2018-09-13 11:16:27 +02:00
Neven Sajko
4a722e80d8 Add braces to if, else, for, while ... (#11504) 2018-09-13 10:17:26 +02:00
pancake
35bd0fbf06 Add pFo, parse certs from mach0's cdhash and minor x509 cleanup 2018-09-13 01:15:18 +02:00
radare
3cc11aa9fe
Some cleanup in ASN1/X509/PKCS7 to make pF work (#11499) 2018-09-12 18:43:59 +02:00
radare
4bb4a2ce30
Parse CodeSign blobs and compute sha1/sha256 in mach0 binaries (#11491)
- rabin2 -OC # wip requires proper refactoring and redesign
2018-09-12 16:03:36 +02:00
Maijin
394d125b79
Check canary with symbols fix #11477 2018-09-11 14:00:12 +02:00
Maijin
2b8c94c2cf Fix #11418 dbg_file in full (#11453) 2018-09-10 16:25:50 +02:00
Giovanni
1dbdabf83c C-Sky and MCore support for r2 (#11448) 2018-09-08 19:52:33 +02:00
Maijin
e935992de5 More verbose idpd 2018-09-08 13:11:10 +02:00
David CARLIER
09e8ccead3 Redo the previous PR. (#11415)
Fix couple of memory leaks only removed
one faulty line which led to garbage.
2018-09-06 12:43:50 +02:00
Riccardo Schirone
1b32083995 Travis was green (#11408)
* anal_x86: keep same syntax and POP value out of esil stack in push sp

NOTE: The other syntax was causing issues in afta, not sure why

* Revert "Further mem leak fixes (#11398)"

This reverts commit 38d9170f5da82ece05d1b90e366763999e633e34.

* anal_x86_cs: just use one expression for the PUSH x86 operation

* libr/core/cmd: set core_sysenv only when calling external scripts
2018-09-06 03:51:02 +02:00
David CARLIER
38d9170f5d Further mem leak fixes (#11398) 2018-09-05 14:56:29 +02:00
David CARLIER
89d6b8138c Fix couple of minor issues. (#11388) 2018-09-05 11:01:07 +02:00
radare
69e5499f69
Fix last coverity issue found in the ELF parser (#11369) 2018-09-03 23:47:02 +02:00
Riccardo Schirone
eee1385466
Meson private (#11331)
* meson: refactor library cflags
* meson: use visibility=hidden by default
* remove unused var
* magic/meson: replace tabs with spaces
2018-09-03 10:07:28 +02:00
Khairul Azhar Kasmiran
e5b5715be3 Fix #11307 - Fix an ELF clusterfuzz crash (#11354) 2018-09-02 10:41:32 +02:00
Khairul Kasmiran
25d3aa97f9 Add confidence-building promotion 2018-08-30 20:48:20 +08:00
Neven Sajko
d8784641ee Add parentheses in macros where needed for safety (#11290) 2018-08-30 13:16:50 +02:00
Fangrui Song
c69682c001 Extract bin_pe{,64}.c common parts to bin_pe.inc (#11292) 2018-08-29 20:20:05 +02:00
Khairul Azhar Kasmiran
7300d12505 Fix #11235 - Fix one more clusterfuzz crash (#11296) 2018-08-29 20:19:06 +02:00
Riccardo Schirone
6a66a9701e mdmp: fix googlefuzz crash (#11298) 2018-08-29 20:17:28 +02:00
Riccardo Schirone
e6e12f42d5
Fixes #10903: slow bins (#11294)
* mach0: use ut32 because those fields are unsigned in Mach0
* bin_mach0: do not process section if it cannot be read
* bin_vsf: detect infinite loop
2018-08-29 15:19:21 +02:00
Khairul Azhar Kasmiran
65ebf72e66 Fix #11227 - Fix another clusterfuzz crash (#11291) 2018-08-29 10:19:33 +08:00