diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2016-06-10 15:47:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-10 15:47:52 -0700 |
commit | 468cad540fa1b0027cad60456f53feabecdce2bc (patch) | |
tree | 98ef02e6799d14532e274a204fdf563fe781371d | |
parent | 9a04b4bc9c9f090cd2033a0bc3e3a6744e06e1d6 (diff) | |
parent | c56b85408bab232efd7e650f0994272a174e3b92 (diff) | |
download | sfntly-468cad540fa1b0027cad60456f53feabecdce2bc.tar.gz |
Merge pull request #56 from leizleiz/bytearray
Add a bounds check to ByteArray::Get().
-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; } |