Additional changes from requests in PR #640
diff --git a/apps/avifdec.c b/apps/avifdec.c index 8a90ff3..c60bd53 100644 --- a/apps/avifdec.c +++ b/apps/avifdec.c
@@ -37,8 +37,8 @@ printf(" -r,--raw-color : Output raw RGB values instead of multiplying by alpha when saving to opaque formats\n"); printf(" (JPEG only; not applicable to y4m)\n"); printf(" --index : When decoding an image sequence or progressive image, specify which frame index to decode (Default: 0)\n"); - printf(" --progressive : Enable progressive AVIF processing. If a progressive image is encountered, avifdec will use\n"); - printf(" --index to choose which layer to decode (in progressive order).\n"); + printf(" --progressive : Enable progressive AVIF processing. If a progressive image is encountered and --progressive is passed,\n"); + printf(" avifdec will use --index to choose which layer to decode (in progressive order).\n"); printf(" --no-strict : Disable strict decoding, which disables strict validation checks and errors\n"); printf(" -i,--info : Decode all frames and display all image information instead of saving to disk\n"); printf(" --ignore-icc : If the input file contains an embedded ICC profile, ignore it (no-op if absent)\n");
diff --git a/src/read.c b/src/read.c index 7be9f1f..e07e2df 100644 --- a/src/read.c +++ b/src/read.c
@@ -554,7 +554,7 @@ sample->size = sampleSize; sample->spatialID = (uint8_t)lselProp->u.lsel.layerID; sample->sync = AVIF_TRUE; - } else if (allowProgressive && a1lxProp) { + } else if (allowProgressive && item->progressive) { // Progressive image. Decode all layers and expose them all to the user. if (imageCountLimit && (layerCount > imageCountLimit)) { @@ -954,7 +954,12 @@ { if (item->mergedExtents.data && !item->partialMergedExtents) { // Multiple extents have already been concatenated for this item, just return it - memcpy(outData, &item->mergedExtents, sizeof(avifROData)); + if (offset >= item->mergedExtents.size) { + avifDiagnosticsPrintf(diag, "Item ID %u read has overflowing offset", item->id); + return AVIF_RESULT_TRUNCATED_DATA; + } + outData->data = item->mergedExtents.data + offset; + outData->size = item->mergedExtents.size - offset; return AVIF_RESULT_OK; }