[FFmpeg-devel] [PATCH 1/3] avformat/electronicarts: fix EOF check

Peter Ross pross at xvid.org
Thu Nov 17 09:29:55 EET 2022


On Sun, Nov 13, 2022 at 07:44:39PM +0100, Marton Balint wrote:
> Similar to feof(), avio_feof() is only true after an actual overread.
> 
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  libavformat/electronicarts.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
> index e7f0cb9b9e..0a0d6249e8 100644
> --- a/libavformat/electronicarts.c
> +++ b/libavformat/electronicarts.c
> @@ -582,9 +582,9 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
>      int av_uninit(num_samples);
>  
>      while ((!packet_read && !hit_end) || partial_packet) {
> +        chunk_type = avio_rl32(pb);
>          if (avio_feof(pb))
>              return AVERROR_EOF;
> -        chunk_type = avio_rl32(pb);
>          chunk_size = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb);
>          if (chunk_size < 8)
>              return AVERROR_INVALIDDATA;
> -- 
> 2.35.3

lgtm

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20221117/3e3600ba/attachment.sig>


More information about the ffmpeg-devel mailing list