Add bounds checks to SkTDynamicHash

BUG=391001
R=bsalomon@google.com, mtklein@google.com, sugoi@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/380443002
diff --git a/src/core/SkTDynamicHash.h b/src/core/SkTDynamicHash.h
index c9a0b3e..445a45d 100644
--- a/src/core/SkTDynamicHash.h
+++ b/src/core/SkTDynamicHash.h
@@ -63,6 +63,7 @@
     T* find(const Key& key) const {
         int index = this->firstIndex(key);
         for (int round = 0; round < fCapacity; round++) {
+            SkASSERT(index >= 0 && index < fCapacity);
             T* candidate = fArray[index];
             if (Empty() == candidate) {
                 return NULL;
@@ -100,6 +101,7 @@
     int countCollisions(const Key& key) const {
         int index = this->firstIndex(key);
         for (int round = 0; round < fCapacity; round++) {
+            SkASSERT(index >= 0 && index < fCapacity);
             const T* candidate = fArray[index];
             if (Empty() == candidate || Deleted() == candidate || GetKey(*candidate) == key) {
                 return round;
@@ -163,6 +165,7 @@
         const Key& key = GetKey(*newEntry);
         int index = this->firstIndex(key);
         for (int round = 0; round < fCapacity; round++) {
+            SkASSERT(index >= 0 && index < fCapacity);
             const T* candidate = fArray[index];
             if (Empty() == candidate || Deleted() == candidate) {
                 if (Deleted() == candidate) {
@@ -181,6 +184,7 @@
         const int firstIndex = this->firstIndex(key);
         int index = firstIndex;
         for (int round = 0; round < fCapacity; round++) {
+            SkASSERT(index >= 0 && index < fCapacity);
             const T* candidate = fArray[index];
             if (Deleted() != candidate && GetKey(*candidate) == key) {
                 fDeleted++;