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

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: remove unneeded cast 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
« src/messages.cc ('K') | « src/wasm/wasm-module.h ('k') | no next file » | 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 97268a1364a617f790f4f7e958f033c4b286dbc3..fd5eb3080efa3f8cb5928c6b6e98d36c753860c2 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -978,12 +978,22 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, 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
« src/messages.cc ('K') | « src/wasm/wasm-module.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698