From b36028d1d1a54acec3e391b2dfe1c6f121b70a5c Mon Sep 17 00:00:00 2001 From: Rangi Date: Tue, 25 Aug 2026 15:47:27 -0400 Subject: [PATCH] Avoid unsigned overflow in `INCBIN` slice size check --- src/asm/section.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/asm/section.cpp b/src/asm/section.cpp index ea35ae39..733ca3db 100644 --- a/src/asm/section.cpp +++ b/src/asm/section.cpp @@ -1053,7 +1053,7 @@ bool sect_BinaryFileSlice(std::string const &name, uint32_t startPos, uint32_t l *fileSize ); return false; - } else if (startPos + length > *fileSize) { + } else if (length > *fileSize - startPos) { error( "Specified range in `INCBIN` file \"%s\" is out of bounds (%" PRIu32 " + %" PRIu32 " > %" PRIu64 ")",