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

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

Issue 1533593004: Fix several wasm warnings an a use after free. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 years 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/encoder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/module-decoder.cc
diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc
index 82588bda07e9afacbe33ac8610a230a5b372ab13..349a4e5f56ddeb73c181e82dba0dcdd8189cf91c 100644
--- a/src/wasm/module-decoder.cc
+++ b/src/wasm/module-decoder.cc
@@ -371,7 +371,8 @@ class ModuleDecoder : public Decoder {
str << "in function #" << func_num << ": ";
// TODO(titzer): add function name for the user?
str << result;
- const char* raw = str.str().c_str();
+ std::string strval = str.str();
+ const char* raw = strval.c_str();
size_t len = strlen(raw);
char* buffer = new char[len];
strncpy(buffer, raw, len);
@@ -387,7 +388,7 @@ class ModuleDecoder : public Decoder {
// the offset is within bounds and advances.
uint32_t offset(const char* name = nullptr) {
uint32_t offset = u32(name ? name : "offset");
- if (offset > (limit_ - start_)) {
+ if (offset > static_cast<uint32_t>(limit_ - start_)) {
error(pc_ - sizeof(uint32_t), "offset out of bounds of module");
}
return offset;
« no previous file with comments | « src/wasm/encoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698