Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avformat/mov: ignore old infe box versions
@ 2024-04-13 13:11 James Almer
  2024-04-18 15:29 ` James Almer
  0 siblings, 1 reply; 2+ messages in thread
From: James Almer @ 2024-04-13 13:11 UTC (permalink / raw)
  To: ffmpeg-devel

Some files with no image items have them, and were working prior to the recent
HEIF parsing overhaul.
Ignore such boxes instead, to recover the old behavior.

Fixes a regression since d9fed9df2a9e70c9375d3b2591db35c09303d369.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/mov.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0c892b56c8..160e0b14fb 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -8137,8 +8137,8 @@ static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom, int idx)
     size -= 4;
 
     if (version < 2) {
-        av_log(c->fc, AV_LOG_ERROR, "infe: version < 2 not supported\n");
-        return AVERROR_PATCHWELCOME;
+        avpriv_report_missing_feature(c->fc, "infe version < 2");
+        return 1;
     }
 
     item_id = version > 2 ? avio_rb32(pb) : avio_rb16(pb);
@@ -8209,6 +8209,8 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         ret = mov_read_infe(c, pb, infe, i);
         if (ret < 0)
             return ret;
+        if (ret)
+            return 0;
     }
 
     c->found_iinf = 1;
@@ -9508,14 +9510,15 @@ static int mov_read_header(AVFormatContext *s)
             av_log(s, AV_LOG_ERROR, "error reading header\n");
             return err;
         }
-    } while ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !mov->found_moov && !mov->found_iloc && !mov->moov_retry++);
-    if (!mov->found_moov && !mov->found_iloc) {
+    } while ((pb->seekable & AVIO_SEEKABLE_NORMAL) &&
+             !mov->found_moov && !mov->found_iloc && !mov->found_iinf && !mov->moov_retry++);
+    if (!mov->found_moov && !mov->found_iloc && !mov->found_iinf) {
         av_log(s, AV_LOG_ERROR, "moov atom not found\n");
         return AVERROR_INVALIDDATA;
     }
     av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb));
 
-    if (mov->found_iloc) {
+    if (mov->found_iloc && mov->found_iinf) {
         for (i = 0; i < mov->nb_heif_item; i++) {
             HEIFItem *item = &mov->heif_item[i];
             MOVStreamContext *sc;
-- 
2.44.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avformat/mov: ignore old infe box versions
  2024-04-13 13:11 [FFmpeg-devel] [PATCH] avformat/mov: ignore old infe box versions James Almer
@ 2024-04-18 15:29 ` James Almer
  0 siblings, 0 replies; 2+ messages in thread
From: James Almer @ 2024-04-18 15:29 UTC (permalink / raw)
  To: ffmpeg-devel

On 4/13/2024 10:11 AM, James Almer wrote:
> Some files with no image items have them, and were working prior to the recent
> HEIF parsing overhaul.
> Ignore such boxes instead, to recover the old behavior.
> 
> Fixes a regression since d9fed9df2a9e70c9375d3b2591db35c09303d369.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavformat/mov.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 0c892b56c8..160e0b14fb 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -8137,8 +8137,8 @@ static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom, int idx)
>       size -= 4;
>   
>       if (version < 2) {
> -        av_log(c->fc, AV_LOG_ERROR, "infe: version < 2 not supported\n");
> -        return AVERROR_PATCHWELCOME;
> +        avpriv_report_missing_feature(c->fc, "infe version < 2");
> +        return 1;
>       }
>   
>       item_id = version > 2 ? avio_rb32(pb) : avio_rb16(pb);
> @@ -8209,6 +8209,8 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>           ret = mov_read_infe(c, pb, infe, i);
>           if (ret < 0)
>               return ret;
> +        if (ret)
> +            return 0;
>       }
>   
>       c->found_iinf = 1;
> @@ -9508,14 +9510,15 @@ static int mov_read_header(AVFormatContext *s)
>               av_log(s, AV_LOG_ERROR, "error reading header\n");
>               return err;
>           }
> -    } while ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !mov->found_moov && !mov->found_iloc && !mov->moov_retry++);
> -    if (!mov->found_moov && !mov->found_iloc) {
> +    } while ((pb->seekable & AVIO_SEEKABLE_NORMAL) &&
> +             !mov->found_moov && !mov->found_iloc && !mov->found_iinf && !mov->moov_retry++);
> +    if (!mov->found_moov && !mov->found_iloc && !mov->found_iinf) {
>           av_log(s, AV_LOG_ERROR, "moov atom not found\n");
>           return AVERROR_INVALIDDATA;
>       }
>       av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb));
>   
> -    if (mov->found_iloc) {
> +    if (mov->found_iloc && mov->found_iinf) {
>           for (i = 0; i < mov->nb_heif_item; i++) {
>               HEIFItem *item = &mov->heif_item[i];
>               MOVStreamContext *sc;

Will apply.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-18 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-13 13:11 [FFmpeg-devel] [PATCH] avformat/mov: ignore old infe box versions James Almer
2024-04-18 15:29 ` James Almer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git