Fix qoi_desc colorspace check
This commit is contained in:
parent
6c83cf2e0c
commit
92f7ebd3f8
3
qoi.h
3
qoi.h
@ -344,7 +344,7 @@ void *qoi_encode(const void *data, const qoi_desc *desc, int *out_len) {
|
|||||||
data == NULL || out_len == NULL || desc == NULL ||
|
data == NULL || out_len == NULL || desc == NULL ||
|
||||||
desc->width == 0 || desc->height == 0 ||
|
desc->width == 0 || desc->height == 0 ||
|
||||||
desc->channels < 3 || desc->channels > 4 ||
|
desc->channels < 3 || desc->channels > 4 ||
|
||||||
(desc->colorspace & 0xf0) != 0
|
desc->colorspace > 2
|
||||||
) {
|
) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -480,6 +480,7 @@ void *qoi_decode(const void *data, int size, qoi_desc *desc, int channels) {
|
|||||||
if (
|
if (
|
||||||
desc->width == 0 || desc->height == 0 ||
|
desc->width == 0 || desc->height == 0 ||
|
||||||
desc->channels < 3 || desc->channels > 4 ||
|
desc->channels < 3 || desc->channels > 4 ||
|
||||||
|
desc->colorspace > 2 ||
|
||||||
header_magic != QOI_MAGIC
|
header_magic != QOI_MAGIC
|
||||||
) {
|
) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user