From 0ca7a88e64500df906b6c24e99a81c40848725a2 Mon Sep 17 00:00:00 2001 From: Florin Malita Date: Mon, 7 May 2018 10:02:13 -0400 Subject: [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 Commit-Queue: Florin Malita --- experimental/skottie/SkottieJson.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'experimental') 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 { -- cgit v1.2.3