mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-03-24 09:31:08 +08:00
CParser: prevent crash when parsing
if the trimmed token length is zero, charAt() explodes this is likely a bad macro, but CParser should not crash regardless
This commit is contained in:
@@ -878,10 +878,9 @@ public class DefineTable {
|
||||
pos = startPos;
|
||||
int endParen = strValue.indexOf(')', pos + 1);
|
||||
if (endParen != -1) {
|
||||
String subStr = strValue.substring(pos + 1, endParen);
|
||||
String subStr = strValue.substring(pos + 1, endParen).trim();
|
||||
if (subStr.length() > 0) {
|
||||
int subPos = 0;
|
||||
subStr = subStr.trim();
|
||||
boolean isValid = Character.isJavaIdentifierStart(subStr.charAt(0));
|
||||
while (isValid && subPos < subStr.length()) {
|
||||
char ch = subStr.charAt(subPos++);
|
||||
|
||||
Reference in New Issue
Block a user