Skip to content
Permalink
Browse files Browse the repository at this point in the history
Re-sync with internal repository (#791)
Co-authored-by: Facebook Community Bot <6422482+facebook-github-bot@users.noreply.github.com>
  • Loading branch information
facebook-github-bot and facebook-github-bot committed Aug 2, 2022
1 parent 8984dc9 commit 5b6255a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/VM/detail/IdentifierHashTable.cpp
Expand Up @@ -138,6 +138,10 @@ void IdentifierHashTable::remove(const StringPrimitive *str) {
}

void IdentifierHashTable::growAndRehash(uint32_t newCapacity) {
// Guard against potential overflow in the calculation of new capacity.
if (LLVM_UNLIKELY(newCapacity <= capacity())) {
hermes_fatal("too many identifiers created");
}
assert(llvh::isPowerOf2_32(newCapacity) && "capacity must be power of 2");
CompactTable tmpTable(newCapacity, table_.getCurrentScale());
tmpTable.swap(table_);
Expand Down

0 comments on commit 5b6255a

Please sign in to comment.