44 Commits

Author SHA1 Message Date
Edward Larson 4f5401601b Fix for issue #427 (#429)
* Add support for MSP430

* Fix test-all.sh

* Use corrected TableGen output files

* Fix bindings for EVM and MSP430

* Remove LLVM_CONSTEXPR (like upstream LLVM did) and fix Java binding

See https://github.com/llvm-mirror/llvm/commit/6feedc56f7855aa24baf759f3bc17112ecbf5699#diff-d14f03e012a2bdbf93486dc1c4ce95ec

* Revert bindings

* Remove added files as well

* Add back changes for bindings created by const_gnerator

* Add back changes for other bindings

* Update CREDITS.TXT

* Fix ADRP instruction encoding

* Trigger checks on PR again, it failed for some reason unrelated to my code

* Add correct offset checks back in

* added llvm support post jan 2

* Remove bounds check on ppc branch instructions target address (fix issue 423)

* Fix vm address reset in aliased PPC instructions

* Fix vm address reset in aliased PPC instructions

(cherry picked from commit 06425a32f3)

* Remove bounds check on ppc branch instructions target address (fix issue 423)

(cherry picked from commit 06afb493e0)

* Clean up test for issue #427

Co-authored-by: Trey Keown <trey@redballoonsecurity.com>
Co-authored-by: Dan Pesce <dan@redballoonsecurity.com>
Co-authored-by: Trey Keown <jfktrey@gmail.com>
Co-authored-by: Nguyen Anh Quynh <aquynh@gmail.com>
2020-06-14 16:04:10 +08:00
Catena cyber d49b6fa401 Sets a default radix (#382)
* Sets a default radix

* Default radix is 16
2019-02-08 10:26:25 +08:00
Catena cyber 0f19fa9acd Only frees instruction if allocated (#375)
* Only frees instruction if allocated

* Avoids memory leak in ks_close for EVM
2018-09-13 12:22:39 +08:00
Christian Sharpsten ae8d127e34 Fix spelling errors in libkeystone (#346) 2018-04-01 00:39:46 +08:00
Nguyen Anh Quynh 80d46cee40 add Ethereum VM architecture 2018-03-31 00:08:28 +08:00
Nguyen Anh Quynh d7ba8e378e ks_close() reports error on invalid handle 2018-01-24 16:25:28 +08:00
Peter Matula 1815d79beb rename namespace "llvm" to "llvm_ks" (#333)
This prevents symbol collisions when the Keystone library is linked with the LLVM libraries.

Renaming was done by the following repository-wide substitutions:
* `namespace llvm` -> `namespace llvm_ks`
* `llvm::` -> `llvm_ks::`
2018-01-23 11:29:52 +08:00
Nguyen Anh Quynh 986b7367f7 arm: handle V8 mode 2016-10-30 23:26:10 +08:00
mrexodia a7237baec0 initialize variables correctly in ks_struct. closes #250 2016-10-13 15:13:25 +02:00
Nguyen Anh Quynh 7623db887d support symbol resolving at run-time by adding new setup option KS_OPT_SYM_RESOLVER. see issue #244 2016-10-02 13:54:37 +08:00
Nguyen Anh Quynh eac9cc9d67 support new syntax RADIX16. see issue #11 2016-09-10 02:04:54 +08:00
quangnh89 7d2cf33de8 fix memory leaks in ks_asm().
use KS_ERR_NOMEM instead of -1.
2016-08-01 15:53:43 +07:00
quangnh89 4a0b85fba8 fix memory leaks in ks_asm(). 2016-08-01 15:33:12 +07:00
Nguyen Anh Quynh e112cc7bbd Merge pull request #178 from adrianherrera/improvement/fixed-function-arg-types
Changed argument types for ks_option and ks_free functions
2016-06-05 23:13:19 +07:00
Adrian Herrera 41c9d1c977 Changed argument type for the ks_free function
* ks_free: The 'p' argument should have type unsigned char* to match the type of the 'encoding' argument to ks_asm
2016-06-05 17:06:33 +10:00
Nguyen Anh Quynh 8b7ca00c50 x86: fix issue #168 2016-06-05 15:06:04 +08:00
Nguyen Anh Quynh 070b5add69 x86: fix crash-21-x64-llvm-error-expected-absolute-expression.c 2016-05-31 15:08:32 +08:00
Nguyen Anh Quynh 499f78265e handle error in peekTok(). this fixes c-crashes/crash-04-hexagon-readcount-not-equal-to-one.c 2016-05-31 00:43:35 +08:00
Nguyen Anh Quynh 63317d5757 handle equal directive. this fixes c-crashes/crash-12-x64-cannot-set-a-variable-that-has-already-been-used.c 2016-05-30 01:52:44 +08:00
Nguyen Anh Quynh 6eb7703b3c handle error in applyFixup(). this fixes c-crashes/crash-23-x64-value-does-not-fit-in-the-fixup-field.c 2016-05-30 00:55:46 +08:00
Nguyen Anh Quynh a992d95048 x86: report unsupported instructions in encodeInstruction(). this fixes c-crashes/crash-24-x64-not-is16bitmemoperand.c 2016-05-30 00:28:11 +08:00
Nguyen Anh Quynh e644380b1b handle parser error in getIntVal(), getAPIntVal() & Lex(). this fixes some crashes in c-crashes 2016-05-30 00:04:26 +08:00
Ingmar Steen fc6ff81e80 The aarch64 target is actually little endian. 2016-05-24 10:01:32 +02:00
Nguyen Anh Quynh ef0e95ac4b make ks_strerror() support new error code 2016-05-22 19:13:29 +08:00
Nguyen Anh Quynh 03193cd9cc rename KS_ERR_ASM_SYMBOL_NOTFOUND to KS_ERR_ASM_SYMBOL_MISSING 2016-05-18 02:14:04 +08:00
Nguyen Anh Quynh fbea39ccd7 propagate the error of missing symbol back to ks_asm(). this adds new error code KS_ERR_ASM_SYMBOL_NOTFOUND. fix issue #61 2016-05-18 01:56:02 +08:00
Nguyen Anh Quynh c5ca679598 add error code KS_ERR_ASM_SYMBOL_REDEFINED to report redefined symbols. also updated all the bindings after this 2016-05-17 22:19:30 +08:00
Ingmar Steen 9753f80739 Fix memory leaks.
Uses new / delete like in mrexodia's patch, deletes things allocated
in ks_asm properly, clean up properly in ks_close. Removed 2 deletes
from the MCObjectStreamer destructor that we re-use in a second run
of ks_asm on the same keystone instance.

Valgrind shows no invalid reads and no memory leaks in keystone after
running the regression tests.
2016-05-15 22:12:04 +02:00
Nguyen Anh Quynh 0a08b30c53 revert to use calloc/free rather than new/delete for ks_struct. this fixes a segfault on Ubuntu 14.04 64bit 2016-05-14 13:49:45 +08:00
mrexodia 19864990dc zero contents 2016-05-13 18:12:14 +02:00
mrexodia 3a2ed19fcb replaced calloc/free with new/delete 2016-05-13 17:41:42 +02:00
mrexodia 45fe02cee3 fixed memory leaks in ks_open 2016-05-13 16:57:56 +02:00
Ingmar Steen 3efea29173 Fix absolute symbol addresses.
By adding BaseAddress to MCContext, passing it from ks_asm and using it
to initialise the address of the first fragment we make sure that
symbols get the right absolute offset.
2016-05-12 20:33:09 +02:00
Nguyen Anh Quynh eb10c9abdd more error string for ks_strerror() 2016-05-11 12:04:38 +08:00
Nguyen Anh Quynh 27b03a29ad x86: ';' is now considered comment until EOL 2016-05-07 21:21:14 +08:00
Nguyen Anh Quynh 68e3ed8802 x86: support for NASM directive in db/dw/dd/dq 2016-05-07 17:53:29 +08:00
Nguyen Anh Quynh 104b1836a8 x86: fix issue #5 for AT&T syntax 2016-05-04 00:36:03 +08:00
Nguyen Anh Quynh 27c91be746 ks_open: change the data type of mode to int. this fixes issue #22 2016-05-03 21:25:43 +08:00
pancake f1e56ec237 Fix ks_errno signature to return ks_err instead of uint 2016-05-02 00:24:19 +02:00
Nguyen Anh Quynh c8c7ecd01c x86: added GNU GAS syntax, which is similar to AT&T syntax 2016-04-30 23:39:44 +08:00
Nguyen Anh Quynh bf695283e0 x86: initial support for NASM syntax 2016-04-30 17:54:01 +08:00
Nguyen Anh Quynh ffd51b5d96 x86: fix ks_option() for Intel syntax KS_OPT_SYNTAX_INTEL 2016-04-30 16:00:08 +08:00
Loi Anh Tuan 7a710e0b48 invoke contructor of struct ks to initialize all the members 2016-04-28 23:56:02 +08:00
Nguyen Anh Quynh 9f1a353f68 import 2016-04-28 21:06:49 +08:00