Procházet zdrojové kódy

Relaxing an assert in TinyDictionary

It is possible and ok for the data to contain `FF`.
The assert that we have in `TryGetValue` could get triggered if an unsuccessfull lookup goes through this value. The added code in the test does that.
Vladimir Sadov před 7 roky
rodič
revize
e8459ba3e4
2 změnil soubory, kde provedl 8 přidání a 1 odebrání
  1. 1 1
      lib/Runtime/Types/TypePath.h
  2. 7 0
      test/Bugs/OS_17745531.js

+ 1 - 1
lib/Runtime/Types/TypePath.h

@@ -86,7 +86,7 @@ public:
                         break;
                     }
 
-                    Assert(idx != (next[idx] & 127));
+                    Assert(next[idx] == NIL || (next[idx] & 127) != idx);
                     i = next[idx];
                 }
             }

+ 7 - 0
test/Bugs/OS_17745531.js

@@ -41,6 +41,13 @@ for (let j = 0; j < 127; j++)
     {
         console.log("fail");
     }
+
+    // just check for asserts when doing lookups
+    for (let i = 0; i < 500; i++) {
+        if (obj1['prop' + i] == "qq") {
+            console.log("hmm");
+        }
+    }
 }
 
 console.log("pass");