From 2e6a962a8271e85814df34ba249cadbee593381c Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 17 Mar 2022 15:41:51 -0400 Subject: [PATCH] Fixed compilation in qoi for 32-bit platforms --- src/pixie/fileformats/qoi.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pixie/fileformats/qoi.nim b/src/pixie/fileformats/qoi.nim index 6a7d24d..5e2b02e 100644 --- a/src/pixie/fileformats/qoi.nim +++ b/src/pixie/fileformats/qoi.nim @@ -49,7 +49,7 @@ proc decodeQoiRaw*(data: string): Qoi {.raises: [PixieError].} = if channels notin {3, 4} or colorspace notin {0, 1}: raise newException(PixieError, "Invalid QOI header") - if width.int * height.int > uint32.high.int: + if width.int * height.int > uint32.high.int64: raise newException(PixieError, "QOI is too large to decode") result = Qoi() @@ -128,7 +128,7 @@ proc decodeQoi*(data: string): Image {.raises: [PixieError].} = proc encodeQoi*(qoi: Qoi): string {.raises: [PixieError].} = ## Encodes raw QOI pixels to the QOI file format. - if qoi.width.int * qoi.height.int > uint32.high.int: + if qoi.width.int * qoi.height.int > uint32.high.int64: raise newException(PixieError, "QOI is too large to encode") # Allocate a buffer 3/4 the size of the pathological encoding