mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-20 21:30:59 +00:00
Fix sign of bounds check.
This commit is contained in:
parent
c0ce62ed2b
commit
09e2ef334b
@ -23,7 +23,7 @@ bool Analyser::Static::Commodore::File::is_basic() {
|
|||||||
// ... null-terminated code ...
|
// ... null-terminated code ...
|
||||||
// (with a next line address of 0000 indicating end of program)
|
// (with a next line address of 0000 indicating end of program)
|
||||||
while(1) {
|
while(1) {
|
||||||
if(size_t(line_address - starting_address) >= data.size() + 2) break;
|
if(size_t(line_address - starting_address) >= data.size() - 2) break;
|
||||||
|
|
||||||
uint16_t next_line_address = data[line_address - starting_address];
|
uint16_t next_line_address = data[line_address - starting_address];
|
||||||
next_line_address |= data[line_address - starting_address + 1] << 8;
|
next_line_address |= data[line_address - starting_address + 1] << 8;
|
||||||
@ -33,7 +33,7 @@ bool Analyser::Static::Commodore::File::is_basic() {
|
|||||||
}
|
}
|
||||||
if(next_line_address < line_address + 5) break;
|
if(next_line_address < line_address + 5) break;
|
||||||
|
|
||||||
if(size_t(line_address - starting_address) >= data.size() + 5) break;
|
if(size_t(line_address - starting_address) >= data.size() - 5) break;
|
||||||
uint16_t next_line_number = data[line_address - starting_address + 2];
|
uint16_t next_line_number = data[line_address - starting_address + 2];
|
||||||
next_line_number |= data[line_address - starting_address + 3] << 8;
|
next_line_number |= data[line_address - starting_address + 3] << 8;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user