Commit 4349e32d authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[ubsan] Fix overflow in AdjustAmountOfExternalAllocatedMemory

Similar issue as crbug.com/933103, so the fix follows the same
pattern too.

No regression test, because it will OOM anyway.

Bug: chromium:957015
Change-Id: Ic5b67d84aa1c44609e6c96485974af9ecab2ed0e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1585854
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61101}
parent 4995c85f
......@@ -10881,7 +10881,8 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
*external_memory = amount;
int64_t allocation_diff_since_last_mc =
*external_memory - *external_memory_at_last_mc;
static_cast<int64_t>(static_cast<uint64_t>(*external_memory) -
static_cast<uint64_t>(*external_memory_at_last_mc));
// Only check memory pressure and potentially trigger GC if the amount of
// external memory increased.
if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment