mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
Sleigh token fields bounds
A token field should be bound by the size of the token, avoid invalid fields, most likely off-by-one errors
This commit is contained in:
parent
c1a1482988
commit
a7ceaedb0c
1 changed files with 5 additions and 1 deletions
|
@ -212,7 +212,11 @@ fielddef
|
|||
} fieldmods) {
|
||||
if ($fielddef.size() > 0 && $fielddef::fieldQuality != null) {
|
||||
if ($tokendef.size() > 0 && $tokendef::tokenSymbol != null) {
|
||||
sc.addTokenField(find(n), $tokendef::tokenSymbol, $fielddef::fieldQuality);
|
||||
if ($tokendef::tokenSymbol.getToken().getSize()*8 <= $fielddef::fieldQuality.high) {
|
||||
reportError(find($t), "field high must be less than token size");
|
||||
} else {
|
||||
sc.addTokenField(find(n), $tokendef::tokenSymbol, $fielddef::fieldQuality);
|
||||
}
|
||||
} else if ($contextdef.size() > 0 && $contextdef::varnode != null) {
|
||||
if (!sc.addContextField($contextdef::varnode, $fielddef::fieldQuality)) {
|
||||
reportError(find($t), "all context definitions must come before constructors");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue