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

Commit 468cad5

Browse files
authored
Merge pull request #56 from leizleiz/bytearray
Add a bounds check to ByteArray::Get().
2 parents 9a04b4b + c56b854 commit 468cad5

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)