Stop trying to use sentinal values for addresses and just keep a
boolean tracking whether they've been initialized. Avoids precision
errors in the variables.
Signed-off-by: Keith Packard <keithp@keithp.com>
}
long extended_addr = 0;
}
long extended_addr = 0;
- long base = 0xffffffff;
- long bound = 0x00000000;
+ long base = 0;
+ long bound = 0;
+ boolean set = false;
for (HexRecord record : record_list) {
switch (record.type) {
case 0:
long addr = extended_addr + record.address;
long r_bound = addr + record.data.length;
for (HexRecord record : record_list) {
switch (record.type) {
case 0:
long addr = extended_addr + record.address;
long r_bound = addr + record.data.length;
+ if (!set || addr < base)
+ if (!set || r_bound > bound)
+ if (!set || base >= bound)
throw new IOException("invalid hex file");
if (bound - base > 4 * 1024 * 1024)
throw new IOException("invalid hex file");
if (bound - base > 4 * 1024 * 1024)