Check for grid images consistently
If an image is a grid image, the grid's rows and columns are both
nonzero. Therefore, the check
(grid.rows > 0) && (grid.columns > 0)
and the check
(grid.rows > 0) || (grid.columns > 0)
are equivalent. Standardize on the first form, which is the prevalent
style in libavif.
diff --git a/src/read.c b/src/read.c
index 5d8eb43..0cfe4c4 100644
--- a/src/read.c
+++ b/src/read.c
@@ -2462,7 +2462,7 @@
return AVIF_RESULT_UNKNOWN_ERROR;
}
- if ((decoder->data->colorGrid.rows > 0) || (decoder->data->colorGrid.columns > 0)) {
+ if ((decoder->data->colorGrid.rows > 0) && (decoder->data->colorGrid.columns > 0)) {
if (!avifDecoderDataFillImageGrid(
decoder->data, &decoder->data->colorGrid, decoder->image, 0, decoder->data->colorTileCount, AVIF_FALSE)) {
return AVIF_RESULT_INVALID_IMAGE_GRID;
@@ -2498,7 +2498,7 @@
avifImageStealPlanes(decoder->image, srcColor, AVIF_PLANES_YUV);
}
- if ((decoder->data->alphaGrid.rows > 0) || (decoder->data->alphaGrid.columns > 0)) {
+ if ((decoder->data->alphaGrid.rows > 0) && (decoder->data->alphaGrid.columns > 0)) {
if (!avifDecoderDataFillImageGrid(
decoder->data, &decoder->data->alphaGrid, decoder->image, decoder->data->colorTileCount, decoder->data->alphaTileCount, AVIF_TRUE)) {
return AVIF_RESULT_INVALID_IMAGE_GRID;