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

Add a bounds check to ByteArray::Get(). #56

Merged
merged 1 commit into from
Jun 10, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions cpp/src/sfntly/data/byte_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ int32_t ByteArray::SetFilledLength(int32_t filled_length) {
}

int32_t ByteArray::Get(int32_t index) {
if (index < 0 || index >= Length())
return -1;
return InternalGet(index) & 0xff;
}

Expand Down