mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 12:58:09 +00:00
decodetree: Properly diagnose fields overflowing an insn
Previously this would result in an exception for shifting the field mask by a negative number. Backports commit 2decfc95583dc28add69810eaca6ada7b4b44d3a from qemu
This commit is contained in:
parent
fcb49bb6f6
commit
4111a3a892
1 changed files with 2 additions and 0 deletions
|
@ -756,6 +756,8 @@ def parse_generic(lineno, is_format, name, toks):
|
|||
sign = True
|
||||
flen = flen[1:]
|
||||
shift = int(flen, 10)
|
||||
if shift + width > insnwidth:
|
||||
error(lineno, 'field {0} exceeds insnwidth'.format(fname))
|
||||
f = Field(sign, insnwidth - width - shift, shift)
|
||||
flds = add_field(lineno, flds, fname, f)
|
||||
fixedbits <<= shift
|
||||
|
|
Loading…
Reference in a new issue