Skip to content

Commit fb65b88

Browse files
victorgomesmibrunin
authored andcommitted
[Backport] CVE-2024-9603: Type Confusion in V8
Cherry-pick of patch originally reviewed on https://chromium-review.googlesource.com/c/v8/v8/+/5901846: Consider WasmStruct in InferHasInPrototypeChain Drive-by: add some CHECKs in not _clearly_ safe uses of AsJSObject to turn possible vulnerablities into crashes. Fixed: 367818758 Change-Id: Ib0464658152ce87141fa137dc6562f17b84bb6be Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5901846 Reviewed-by: Nico Hartmann <[email protected]> Auto-Submit: Victor Gomes <[email protected]> Commit-Queue: Nico Hartmann <[email protected]> Cr-Commit-Position: refs/heads/main@{#96386} (cherry picked from commit 81155a8f3b20fbfc7e36c2419f5326f1d0ad7d75) Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/597918 Reviewed-by: Michal Klocek <[email protected]>
1 parent 4ebc0a6 commit fb65b88

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

chromium/v8/src/compiler/access-info.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,7 @@ PropertyAccessInfo AccessInfoFactory::ComputePropertyAccessInfo(
915915
return PropertyAccessInfo::NotFound(zone(), receiver_map, holder);
916916
}
917917

918+
CHECK(prototype.IsJSObject());
918919
holder = prototype.AsJSObject();
919920
map = map_prototype_map;
920921

chromium/v8/src/compiler/heap-refs.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,7 @@ HolderLookupResult FunctionTemplateInfoRef::LookupHolderOfExpectedType(
16311631
if (!expected_receiver_type->IsTemplateFor(prototype.object()->map())) {
16321632
return not_found;
16331633
}
1634+
CHECK(prototype.IsJSObject());
16341635
return HolderLookupResult(CallOptimization::kHolderFound,
16351636
prototype.AsJSObject());
16361637
}

chromium/v8/src/compiler/js-native-context-specialization.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,9 @@ JSNativeContextSpecialization::InferHasInPrototypeChain(
879879
// might be a different object each time, so it's much simpler to include
880880
// {prototype}. That does, however, mean that we must check {prototype}'s
881881
// map stability.
882-
if (!prototype.map(broker()).is_stable()) return kMayBeInPrototypeChain;
882+
if (!prototype.IsJSObject() || !prototype.map(broker()).is_stable()) {
883+
return kMayBeInPrototypeChain;
884+
}
883885
last_prototype = prototype.AsJSObject();
884886
}
885887
WhereToStart start = result == NodeProperties::kUnreliableMaps

0 commit comments

Comments
 (0)