mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
decodetree: Properly diagnose fields overflowing an insn
Previously this would result in an exception for shifting the field mask by a negative number. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
71ecf79bf4
commit
2decfc9558
5 changed files with 22 additions and 0 deletions
|
@ -622,6 +622,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…
Add table
Add a link
Reference in a new issue