Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Unified Diff: src/wasm/wasm-module.cc

Issue 2010493002: Check CallSite arguments more rigorously (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add regression test case Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/mjsunit/regress/regress-crbug-615774.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index 7ba56ea705640c3a2d1058c992a8e58c6aeaf7b7..3587dd5313020e1b32ad8427eabc8d4113cc2772 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -961,12 +961,22 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const WasmModule* module) {
MaybeHandle<String> GetWasmFunctionName(Handle<JSObject> wasm,
uint32_t func_index) {
+ DCHECK(IsWasmObject(wasm));
Object* func_names_arr_obj = wasm->GetInternalField(kWasmFunctionNamesArray);
if (func_names_arr_obj->IsUndefined()) return Handle<String>::null();
return GetWasmFunctionNameFromTable(
handle(ByteArray::cast(func_names_arr_obj)), func_index);
}
+bool IsWasmObject(Handle<JSObject> object) {
+ // TODO(clemensh): Check wasm byte header once we store a copy of the bytes.
+ return object->GetInternalFieldCount() == kWasmModuleInternalFieldCount &&
+ object->GetInternalField(kWasmModuleCodeTable)->IsFixedArray() &&
+ object->GetInternalField(kWasmMemArrayBuffer)->IsJSArrayBuffer() &&
+ (object->GetInternalField(kWasmFunctionNamesArray)->IsByteArray() ||
+ object->GetInternalField(kWasmFunctionNamesArray)->IsUndefined());
+}
+
} // namespace wasm
} // namespace internal
} // namespace v8
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/mjsunit/regress/regress-crbug-615774.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698