| Index: src/wasm/decoder.h
|
| diff --git a/src/wasm/decoder.h b/src/wasm/decoder.h
|
| index fc8f110b733f93e3eb9693b92cf7eb598aa0f794..3993e1590cf00f3301e4472aaea2bf186ef73350 100644
|
| --- a/src/wasm/decoder.h
|
| +++ b/src/wasm/decoder.h
|
| @@ -34,7 +34,6 @@ class Decoder {
|
| Decoder(const byte* start, const byte* end)
|
| : start_(start),
|
| pc_(start),
|
| - limit_(end),
|
| end_(end),
|
| error_pc_(nullptr),
|
| error_pt_(nullptr) {}
|
| @@ -44,7 +43,7 @@ class Decoder {
|
| inline bool check(const byte* base, unsigned offset, unsigned length,
|
| const char* msg) {
|
| DCHECK_GE(base, start_);
|
| - if ((base + offset + length) > limit_) {
|
| + if ((base + offset + length) > end_) {
|
| error(base, base + offset, "%s", msg);
|
| return false;
|
| }
|
| @@ -190,17 +189,17 @@ class Decoder {
|
| if (checkAvailable(size)) {
|
| pc_ += size;
|
| } else {
|
| - pc_ = limit_;
|
| + pc_ = end_;
|
| }
|
| }
|
|
|
| - // Check that at least {size} bytes exist between {pc_} and {limit_}.
|
| + // Check that at least {size} bytes exist between {pc_} and {end_}.
|
| bool checkAvailable(int size) {
|
| intptr_t pc_overflow_value = std::numeric_limits<intptr_t>::max() - size;
|
| if (size < 0 || (intptr_t)pc_ > pc_overflow_value) {
|
| error(pc_, nullptr, "reading %d bytes would underflow/overflow", size);
|
| return false;
|
| - } else if (pc_ < start_ || limit_ < (pc_ + size)) {
|
| + } else if (pc_ < start_ || end_ < (pc_ + size)) {
|
| error(pc_, nullptr, "expected %d bytes, fell off end", size);
|
| return false;
|
| } else {
|
| @@ -241,11 +240,11 @@ class Decoder {
|
| template <typename T>
|
| T traceOffEnd() {
|
| T t = 0;
|
| - for (const byte* ptr = pc_; ptr < limit_; ptr++) {
|
| + for (const byte* ptr = pc_; ptr < end_; ptr++) {
|
| TRACE("%02x ", *ptr);
|
| }
|
| TRACE("<end>\n");
|
| - pc_ = limit_;
|
| + pc_ = end_;
|
| return t;
|
| }
|
|
|
| @@ -272,7 +271,6 @@ class Decoder {
|
| void Reset(const byte* start, const byte* end) {
|
| start_ = start;
|
| pc_ = start;
|
| - limit_ = end;
|
| end_ = end;
|
| error_pc_ = nullptr;
|
| error_pt_ = nullptr;
|
| @@ -281,7 +279,7 @@ class Decoder {
|
|
|
| bool ok() const { return error_msg_ == nullptr; }
|
| bool failed() const { return !ok(); }
|
| - bool more() const { return pc_ < limit_; }
|
| + bool more() const { return pc_ < end_; }
|
|
|
| const byte* start() { return start_; }
|
| const byte* pc() { return pc_; }
|
| @@ -290,7 +288,6 @@ class Decoder {
|
| protected:
|
| const byte* start_;
|
| const byte* pc_;
|
| - const byte* limit_;
|
| const byte* end_;
|
| const byte* error_pc_;
|
| const byte* error_pt_;
|
| @@ -308,7 +305,7 @@ class Decoder {
|
| const int kMaxLength = (sizeof(IntType) * 8 + 6) / 7;
|
| const byte* ptr = base + offset;
|
| const byte* end = ptr + kMaxLength;
|
| - if (end > limit_) end = limit_;
|
| + if (end > end_) end = end_;
|
| int shift = 0;
|
| byte b = 0;
|
| IntType result = 0;
|
| @@ -358,7 +355,7 @@ class Decoder {
|
| const int kMaxLength = (sizeof(IntType) * 8 + 6) / 7;
|
| const byte* pos = pc_;
|
| const byte* end = pc_ + kMaxLength;
|
| - if (end > limit_) end = limit_;
|
| + if (end > end_) end = end_;
|
|
|
| IntType result = 0;
|
| int shift = 0;
|
|
|