forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user