//
-// RMAC - Reboot's Macro Assembler for all Atari computers
+// RMAC - Renamed Macro Assembler for all Atari computers
// DIRECT.C - Directive Handling
-// Copyright (C) 199x Landon Dyer, 2011-2020 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2021 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
// Attempt to open the include file in the current directory, then (if that
// failed) try list of include files passed in the enviroment string or by
- // the "-d" option.
+ // the "-i" option.
TOKEN filename = tok[1];
if ((fd = open(string[filename], _OPEN_INC)) < 0)
close(fd);
return ERROR;
}
+ if ((int64_t)size <= 0)
+ {
+ return error("invalid incbin size requested");
+ }
}
else
size = lseek(fd, 0L, SEEK_END);
}
lseek(fd, pos, SEEK_SET);
- size -= pos;
+ if ((int64_t)(size - pos) < 0)
+ {
+ return error("requested incbin size out of range");
+ }
}
else
{