Skip to content
This repository was archived by the owner on Oct 5, 2023. It is now read-only.

Commit c56b854

Browse files
committed
Add a bounds check to ByteArray::Get().
1 parent 9a04b4b commit c56b854

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: cpp/src/sfntly/data/byte_array.cc

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ int32_t ByteArray::SetFilledLength(int32_t filled_length) {
3535
}
3636

3737
int32_t ByteArray::Get(int32_t index) {
38+
if (index < 0 || index >= Length())
39+
return -1;
3840
return InternalGet(index) & 0xff;
3941
}
4042

0 commit comments

Comments
 (0)