Commit b336c34
Fix ArrayIndexOutOfBoundsException in Extended XMP processing (drewnoakes#712)
Add bounds validation before System.arraycopy in processExtendedXMPChunk()
to prevent crashes when processing malformed Extended XMP metadata.
The fix handles two edge cases:
- chunkOffset + copyLength exceeds buffer size
- chunkOffset is negative (from uint32 > Integer.MAX_VALUE cast to int)
Uses subtraction instead of addition to avoid integer overflow:
if (chunkOffset < 0 || chunkOffset > buffer.length - copyLength)
Fixes drewnoakes#3081 parent 873adde commit b336c34
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | | - | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
297 | 307 | | |
298 | 308 | | |
299 | 309 | | |
| |||
0 commit comments