diff options
author | Lei Zhang <leizleiz@users.noreply.github.com> | 2016-06-09 23:30:26 -0700 |
---|---|---|
committer | Lei Zhang <leizleiz@users.noreply.github.com> | 2016-06-09 23:30:26 -0700 |
commit | c56b85408bab232efd7e650f0994272a174e3b92 (patch) | |
tree | 98ef02e6799d14532e274a204fdf563fe781371d /cpp | |
parent | 9a04b4bc9c9f090cd2033a0bc3e3a6744e06e1d6 (diff) | |
download | sfntly-c56b85408bab232efd7e650f0994272a174e3b92.tar.gz |
Add a bounds check to ByteArray::Get().
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/sfntly/data/byte_array.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cpp/src/sfntly/data/byte_array.cc b/cpp/src/sfntly/data/byte_array.cc index 915a40c..57f9eed 100644 --- a/cpp/src/sfntly/data/byte_array.cc +++ b/cpp/src/sfntly/data/byte_array.cc @@ -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; } |