gnodet commented on PR #1165:
URL:
https://github.com/apache/maven-compiler-plugin/pull/1165#issuecomment-7394859860
_Claude Code on behalf of Guillaume Nodet_
**Malformed descriptor crash**: `descriptorToReadable()` assumes well-formed
descriptors with closing ';' for reference types. If bytecode is malformed
(e.g., `desc='Lfoo'` without ';'`), `indexOf(';')` returns -1, and
`substring(1, -1)` throws `StringIndexOutOfBoundsException`.
While the JVM would reject such bytecode at load time, the analyzer crashes
during the incremental build scan instead of gracefully handling it.
**Scenario**:
- Corrupted or hand-written .class file with descriptor `'Lfoo'`
- `BytecodeAnalyzer.analyze()` calls `descriptorToReadable('Lfoo')`
- `indexOf(';')` returns -1
- `substring(1, -1)` throws `StringIndexOutOfBoundsException`
- Incremental build crashes instead of falling back or logging warning
**Fix**: Guard with validation as done in the java24 version (line 109):
```java
case 'L':
int semi = desc.indexOf(';', 1);
if (semi > 0) {
return desc.substring(1, semi).replace('/', '.');
}
return desc; // Return malformed descriptor as-is
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]