From bf6951036dd1132c25cc8df251d37ecd663fcb8d Mon Sep 17 00:00:00 2001 From: Dominic Szablewski Date: Thu, 16 Dec 2021 20:13:52 +0100 Subject: [PATCH] Fix check for valid colorspace --- qoi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qoi.h b/qoi.h index 1962164..df84228 100644 --- a/qoi.h +++ b/qoi.h @@ -382,7 +382,7 @@ void *qoi_encode(const void *data, const qoi_desc *desc, int *out_len) { data == NULL || out_len == NULL || desc == NULL || desc->width == 0 || desc->height == 0 || desc->channels < 3 || desc->channels > 4 || - desc->colorspace > 2 || + desc->colorspace > 1 || desc->height >= QOI_PIXELS_MAX / desc->width ) { return NULL; @@ -531,7 +531,7 @@ void *qoi_decode(const void *data, int size, qoi_desc *desc, int channels) { if ( desc->width == 0 || desc->height == 0 || desc->channels < 3 || desc->channels > 4 || - desc->colorspace > 2 || + desc->colorspace > 1 || header_magic != QOI_MAGIC || desc->height >= QOI_PIXELS_MAX / desc->width ) {