Skip to content

Commit c7c3285

Browse files
committed
Fix signed comparison
1 parent 0388dfa commit c7c3285

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/gfx/process.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ class Png {
226226
if (options.inputSlice.height == 0 && height % 8 != 0) {
227227
fatal("Image height (%" PRIu32 " pixels) is not a multiple of 8!", height);
228228
}
229-
if (options.inputSlice.left + options.inputSlice.width * 8 > width
230-
|| options.inputSlice.top + options.inputSlice.height * 8 > height) {
229+
if (options.inputSlice.width * 8 > width - options.inputSlice.left
230+
|| options.inputSlice.height * 8 > height - options.inputSlice.top) {
231231
error(
232232
"Image slice ((%" PRIu32 ", %" PRIu32 ") to (%" PRId32 ", %" PRId32
233233
")) is outside the image bounds (%" PRIu32 "x%" PRIu32 ")!",

0 commit comments

Comments
 (0)