aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2018-05-07 10:02:13 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-07 15:19:39 +0000
commit0ca7a88e64500df906b6c24e99a81c40848725a2 (patch)
tree6438f51c8ab1e465a4c98c6811ad6ad99f4d3ac2 /experimental
parentc3b0822d50e48439febebe176b092295c8f61621 (diff)
[skottie] More defensive array indexing
Rapidjson's array [] operator asserts the index is valid (instead of returning a null value when out-of-range) -> we must check. Bug: skia:7918 Change-Id: Ice4a6e6670a824da0d423da4a6f92414cd0dc252 Reviewed-on: https://skia-review.googlesource.com/126441 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'experimental')
-rw-r--r--experimental/skottie/SkottieJson.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/experimental/skottie/SkottieJson.cpp b/experimental/skottie/SkottieJson.cpp
index 7b2c6ae985..15d86c4ef0 100644
--- a/experimental/skottie/SkottieJson.cpp
+++ b/experimental/skottie/SkottieJson.cpp
@@ -170,7 +170,7 @@ size_t ValueRef::size() const {
}
ValueRef ValueRef::operator[](size_t i) const {
- return this->isArray() ? ValueRef(fValue->operator[](i)) : ValueRef();
+ return i < this->size() ? ValueRef(fValue->operator[](i)) : ValueRef();
}
ValueRef ValueRef::operator[](const char* key) const {