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

Unified Diff: src/wasm/decoder.h

Issue 2410913002: [wasm] Fix decoder for null data (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | test/unittests/wasm/decoder-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/decoder.h
diff --git a/src/wasm/decoder.h b/src/wasm/decoder.h
index b556f932badd25f22215950ed8784568e76731b3..fc8f110b733f93e3eb9693b92cf7eb598aa0f794 100644
--- a/src/wasm/decoder.h
+++ b/src/wasm/decoder.h
@@ -253,7 +253,7 @@ class Decoder {
template <typename T>
Result<T> toResult(T val) {
Result<T> result;
- if (error_pc_) {
+ if (failed()) {
TRACE("Result error: %s\n", error_msg_.get());
result.error_code = kError;
result.start = start_;
@@ -279,8 +279,8 @@ class Decoder {
error_msg_.reset();
}
- bool ok() const { return error_pc_ == nullptr; }
- bool failed() const { return !!error_msg_; }
+ bool ok() const { return error_msg_ == nullptr; }
+ bool failed() const { return !ok(); }
bool more() const { return pc_ < limit_; }
const byte* start() { return start_; }
« no previous file with comments | « no previous file | test/unittests/wasm/decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698