Skip to content

Commit 3db5330

Browse files
authored
Merge pull request #687 from DAN-MU-ZI/main
Issue #685 | Fix StringIndexOutOfBoundsException in ICC DESC tag processing
2 parents 0c3452b + da59f94 commit 3db5330

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: Source/com/drew/metadata/icc/IccDescriptor.java

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
package com.drew.metadata.icc;
2323

24+
import com.drew.lang.BufferBoundsException;
2425
import com.drew.lang.ByteArrayReader;
2526
import com.drew.lang.RandomAccessReader;
2627
import com.drew.lang.annotations.NotNull;
@@ -91,6 +92,11 @@ private String getTagDataString(int tagType)
9192
}
9293
case ICC_TAG_TYPE_DESC:
9394
int stringLength = reader.getInt32(8);
95+
96+
if (stringLength < 0 || stringLength > (bytes.length - 12)) {
97+
throw new BufferBoundsException(12, stringLength, bytes.length);
98+
}
99+
94100
return new String(bytes, 12, stringLength - 1);
95101
case ICC_TAG_TYPE_SIG:
96102
return IccReader.getStringFromInt32(reader.getInt32(8));

0 commit comments

Comments
 (0)