From cb47ac8b9750fb91036fbba2e515e4333fff7339 Mon Sep 17 00:00:00 2001 From: daid Date: Tue, 9 Mar 2021 08:49:48 +0100 Subject: [PATCH] Change the start position check on INCBIN Currently INCBIN gives an error if your start position == file size. This means you cannot include an empty file. It also means the text of the error message is incorrect (as the start is not greater, but equal to the length of the file) --- src/asm/section.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/asm/section.c b/src/asm/section.c index b470a55a..5a59b220 100644 --- a/src/asm/section.c +++ b/src/asm/section.c @@ -774,7 +774,7 @@ void out_BinaryFile(char const *s, int32_t startPos) if (fseek(f, 0, SEEK_END) != -1) { fsize = ftell(f); - if (startPos >= fsize) { + if (startPos > fsize) { error("Specified start position is greater than length of file\n"); fclose(f); return; @@ -841,7 +841,7 @@ void out_BinaryFileSlice(char const *s, int32_t start_pos, int32_t length) if (fseek(f, 0, SEEK_END) != -1) { fsize = ftell(f); - if (start_pos >= fsize) { + if (start_pos > fsize) { error("Specified start position is greater than length of file\n"); return; }