File tree 1 file changed +2
-4
lines changed
1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -93,8 +93,7 @@ uint32_t Interpret(const std::vector<bool> &asmap, const std::vector<bool> &ip)
93
93
jump = DecodeJump (pos, endpos);
94
94
if (jump == INVALID) break ; // Jump offset straddles EOF
95
95
if (bits == 0 ) break ; // No input bits left
96
- if (pos + jump < pos) break ; // overflow
97
- if (pos + jump >= endpos) break ; // Jumping past EOF
96
+ if (int64_t {jump} >= int64_t {endpos - pos}) break ; // Jumping past EOF
98
97
if (ip[ip.size () - bits]) {
99
98
pos += jump;
100
99
}
@@ -156,8 +155,7 @@ bool SanityCheckASMap(const std::vector<bool>& asmap, int bits)
156
155
} else if (opcode == Instruction::JUMP) {
157
156
uint32_t jump = DecodeJump (pos, endpos);
158
157
if (jump == INVALID) return false ; // Jump offset straddles EOF
159
- if (pos + jump < pos) return false ; // overflow
160
- if (pos + jump > endpos) return false ; // Jump out of range
158
+ if (int64_t {jump} > int64_t {endpos - pos}) return false ; // Jump out of range
161
159
if (bits == 0 ) return false ; // Consuming bits past the end of the input
162
160
--bits;
163
161
uint32_t jump_offset = pos - begin + jump;
You can’t perform that action at this time.
0 commit comments