Avoid unsigned overflow in INCBIN slice size check

This commit is contained in:
Rangi
2026-08-25 15:47:27 -04:00
parent 760cc4d464
commit b36028d1d1
+1 -1
View File
@@ -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 ")",