Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: runtime/vm/hash_map.h

Issue 2647763002: Fixed segfault in Remove method. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/hash_map.h
diff --git a/runtime/vm/hash_map.h b/runtime/vm/hash_map.h
index c50d17e87bf9e1fa3ba08d69867078ea6cd4d486..6526acaf5c6b81f5c065e78ca06a10ceea543c2f 100644
--- a/runtime/vm/hash_map.h
+++ b/runtime/vm/hash_map.h
@@ -332,6 +332,12 @@ bool BaseDirectChainedHashMap<KeyValueTrait, B, Allocator>::Remove(
intptr_t current = array_[pos].next;
+ // If there's only the single element in the bucket and it does not match the
+ // key to be removed, just return.
+ if (current == kNil) {
+ return false;
+ }
+
// Check the case where the second element in the bucket is the one to be
// removed.
if (KeyValueTrait::KeyOf(lists_[current].kv) == key) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698