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

Marton Balint cus at passwd.hu
Sun Nov 13 20:44:39 EET 2022


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



More information about the ffmpeg-devel mailing list