New issue
Advanced search Search tips

Issue 656795 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

WTF::HashMap crashes when mapping 0 to WTF::String?

Project Member Reported by zqzh...@chromium.org, Oct 17 2016

Issue description

I tried to map int to String/AtomicString, however found the following test will crash HashMap.

TEST(HashMapTest, IntToStringMapTest) {
  using IntToStringMap = HashMap<int, String>;
  IntToStringMap map;
  map.add(0, "abc");
  auto iter = map.find(0);
  ASSERT_TRUE(iter != map.end());
  EXPECT_EQ("abc", iter->value);
}

It happens for the key is integer 0 and the value is a String/AtomicString.

It reaches an assertion failure at HashTable.h(1243):
ASSERTION FAILED: !isEmptyOrDeletedBucket(*entry)

 

Comment 1 by yutak@chromium.org, Oct 18 2016

Status: WontFix (was: Untriaged)
This is WAI; you can't insert 0 (and -1) as an integer key. They are reserved for
internal use.

OK, Thanks :)

Sign in to add a comment