Move an assertion next to the dependent statement
In avifCodecDecodeInputFillFromDecoderItem(), the assertion
assert(lselProp->u.lsel.layerID < MAX_AV1_LAYER_COUNT);
is apparently intended to ensure that the following uint8_t cast is
safe:
sample->spatialID = (uint8_t)lselProp->u.lsel.layerID;
So move the assertion next to that statement.
diff --git a/src/read.c b/src/read.c
index c77944c..6c3368b 100644
--- a/src/read.c
+++ b/src/read.c
@@ -549,9 +549,9 @@
avifDecodeSample * sample = (avifDecodeSample *)avifArrayPushPtr(&decodeInput->samples);
sample->itemID = item->id;
- assert(lselProp->u.lsel.layerID < MAX_AV1_LAYER_COUNT);
sample->offset = 0;
sample->size = sampleSize;
+ assert(lselProp->u.lsel.layerID < MAX_AV1_LAYER_COUNT);
sample->spatialID = (uint8_t)lselProp->u.lsel.layerID;
sample->sync = AVIF_TRUE;
} else if (allowProgressive && item->progressive) {