> On Apr 22, 2022, at 4:37 PM, Malviya, Janpriya <janpriya_malv...@bose.com> 
> wrote:
> 
> Hello ffmpeg Dev team,  
> 
> While integrating FFmpeg for M4A , MP4 stream & facing issue that mov demuxer 
> trying to request seek for invalid seek offset.
> 
> Issue details:-
>       - Modified doc/examples/demuxing_decoding.c example to support Custom 
> IO call-back because we have our  own mechanism to read data from source
>       -  In custom IO seek call back , we do not support “whence” values 
> AVSEEK_SIZE & SEEK_END , used to find stream size ( returning -1 in both the 
> cases ).
>       - In attached screen shot , where we are observing seek with invalid 
> seek offset and the seek requested after End of stream is detected
>       - Seek offset value 9223372036854775799 always the same ( I think 
> INT64_MAX – 8 ,  8 is length Atom type & size field )
>       - If we allow to return proper stream size in seek callback then this 
> problem is not observed.

The real issue isn’t about invalid seek offset, but use invalid box
size/type due to EOF.

Add another check just after the eof check in while condition isn’t
efficient. I tried another method:

[1/3] avformat/mov: remove an always true condition
http://ffmpeg.org/pipermail/ffmpeg-devel/2022-April/295712.html

[2/3] reindent

[3/3] avformat/mov: fix use invalid box size/type due to eof
http://ffmpeg.org/pipermail/ffmpeg-devel/2022-April/295713.html

> 
> Fix :
> In attached patch to verify EOS condition before going to parse atom data.
> 
> Signed-off-by: Janpriya Malviya <janpriya_malv...@bose.com>
> ---
> libavformat/mov.c | 4 ++++
> 1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 6c847de..9704550 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -7556,6 +7556,10 @@ static int mov_read_default(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>         if (atom.size >= 8) {
>             a.size = avio_rb32(pb);
>             a.type = avio_rl32(pb);
> +
> +            if(avio_feof(pb))
> +                continue;
> +
>             if (((a.type == MKTAG('f','r','e','e') && c->moov_retry) ||
>                   a.type == MKTAG('h','o','o','v')) &&
>                 a.size >= 8 &&
> -- 
> 2.7.4
> 
> <issueImage.png><reproduce_issue.c>_______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 

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

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

Reply via email to