mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 06:05:31 +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
|
@ -756,6 +756,8 @@ def parse_generic(lineno, is_format, name, toks):
|
||||||
sign = True
|
sign = True
|
||||||
flen = flen[1:]
|
flen = flen[1:]
|
||||||
shift = int(flen, 10)
|
shift = int(flen, 10)
|
||||||
|
if shift + width > insnwidth:
|
||||||
|
error(lineno, 'field {0} exceeds insnwidth'.format(fname))
|
||||||
f = Field(sign, insnwidth - width - shift, shift)
|
f = Field(sign, insnwidth - width - shift, shift)
|
||||||
flds = add_field(lineno, flds, fname, f)
|
flds = add_field(lineno, flds, fname, f)
|
||||||
fixedbits <<= shift
|
fixedbits <<= shift
|
||||||
|
|
Loading…
Reference in a new issue