diff options
author | John Darrington <john@darrington.wattle.id.au> | 2019-04-29 16:05:54 +0200 |
---|---|---|
committer | John Darrington <john@darrington.wattle.id.au> | 2019-04-29 16:10:21 +0200 |
commit | 4a90ce955e5bcde074b8616ff9d20f9939a9a358 (patch) | |
tree | c44101f47bfff2e3b577d3e2f6ee75b3b40d6ef9 /opcodes | |
parent | 637d4b78c55640b9d858546a65d51024a70b5247 (diff) | |
download | gdb-4a90ce955e5bcde074b8616ff9d20f9939a9a358.zip gdb-4a90ce955e5bcde074b8616ff9d20f9939a9a358.tar.gz gdb-4a90ce955e5bcde074b8616ff9d20f9939a9a358.tar.bz2 |
S12Z: Opcodes: Fix crash when trying to decode a truncated operation.
opcodes/
* s12z-opc.c (shift_discrim): Return OP_INVALID when reading fails.
gas/
* testsuite/gas/s12z/truncated.d: New file.
* testsuite/gas/s12z/truncated.s: New file.
* testsuite/gas/s12z/s12z.exp: Add new test.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 4 | ||||
-rw-r--r-- | opcodes/s12z-opc.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 0c2980f..1c9bdbc 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2019-04-29 John Darrington <john@darrington.wattle.id.au> + + * s12z-opc.c (shift_discrim): Return OP_INVALID when reading fails. + 2019-04-26 Andrew Bennett <andrew.bennett@imgtec.com> Faraz Shahbazker <fshahbazker@wavecomp.com> diff --git a/opcodes/s12z-opc.c b/opcodes/s12z-opc.c index e40f90e..eef097d 100644 --- a/opcodes/s12z-opc.c +++ b/opcodes/s12z-opc.c @@ -2292,7 +2292,7 @@ shift_discrim (struct mem_read_abstraction_base *mra, enum optr hint ATTRIBUTE_ uint8_t sb; int status = mra->read (mra, 0, 1, &sb); if (status < 0) - return status; + return OP_INVALID; enum SB_DIR dir = (sb & 0x40) ? SB_LEFT : SB_RIGHT; enum SB_TYPE type = (sb & 0x80) ? SB_ARITHMETIC : SB_LOGICAL; |