Commit be526b1e authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[log] Fix off-thread use of string.Get

Fixed: v8:12233
Change-Id: If23330e2edd6f4e2352800c145fc3ad5a360be5a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3162055
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76853}
parent 46540df8
......@@ -12,7 +12,10 @@
#include "src/base/strings.h"
#include "src/base/vector.h"
#include "src/common/assert-scope.h"
#include "src/common/globals.h"
#include "src/execution/isolate-utils.h"
#include "src/objects/objects-inl.h"
#include "src/objects/string-inl.h"
#include "src/strings/string-stream.h"
#include "src/utils/version.h"
......@@ -108,10 +111,12 @@ void Log::MessageBuilder::AppendString(String str,
if (str.is_null()) return;
DisallowGarbageCollection no_gc; // Ensure string stays valid.
PtrComprCageBase cage_base = GetPtrComprCageBase(str);
SharedStringAccessGuardIfNeeded access_guard(str);
int length = str.length();
if (length_limit) length = std::min(length, *length_limit);
for (int i = 0; i < length; i++) {
uint16_t c = str.Get(i);
uint16_t c = str.Get(i, cage_base, access_guard);
if (c <= 0xFF) {
AppendCharacter(static_cast<char>(c));
} else {
......
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