Commit c4d09aef authored by Rob Paveza's avatar Rob Paveza Committed by V8 LUCI CQ

SHA256 hash crash: GetScriptHash

Initialization after reset + unnecessary use of handle scope appear to
be the culprit here. Most of the other functions in debug::Script do not
use HandleScope, so this reconciles these differences. Additionally,
the call to obtain and initialize the hash within
ActualScript::Initialize was inconsistent: all of the other fields were
initialized prior to resetting the script and source.

These reconciliations appear to fix this crash.

Bug: chromium:1325036
Change-Id: Ia86e83b6c99955a3ac80a4a8845c0df0172e991c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3648082
Commit-Queue: Robert Paveza <Rob.Paveza@microsoft.com>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Auto-Submit: Robert Paveza <Rob.Paveza@microsoft.com>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80760}
parent bdb20626
......@@ -500,11 +500,9 @@ MaybeLocal<String> Script::SourceMappingURL() const {
MaybeLocal<String> Script::GetSha256Hash() const {
i::Handle<i::Script> script = Utils::OpenHandle(this);
i::Isolate* isolate = script->GetIsolate();
i::HandleScope handle_scope(isolate);
i::Handle<i::String> value =
script->GetScriptHash(/* forceForInspector: */ true);
return Utils::ToLocal(handle_scope.CloseAndEscape(value));
return Utils::ToLocal(value);
}
Maybe<int> Script::ContextId() const {
......
......@@ -265,15 +265,15 @@ class ActualScript : public V8DebuggerScript {
m_isModule = script->IsModule();
m_script.Reset(m_isolate, script);
m_script.AnnotateStrongRetainer(kGlobalDebuggerScriptHandleLabel);
m_scriptSource.Reset(m_isolate, script->Source());
m_scriptSource.AnnotateStrongRetainer(kGlobalDebuggerScriptHandleLabel);
bool hasHash = script->GetSha256Hash().ToLocal(&tmp) && tmp->Length() > 0;
if (hasHash) {
m_hash = toProtocolString(m_isolate, tmp);
}
m_script.Reset(m_isolate, script);
m_script.AnnotateStrongRetainer(kGlobalDebuggerScriptHandleLabel);
m_scriptSource.Reset(m_isolate, script->Source());
m_scriptSource.AnnotateStrongRetainer(kGlobalDebuggerScriptHandleLabel);
}
void MakeWeak() override {
......
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