[FFmpeg-cvslog] avformat/wavarc: fix data end calculation

Paul B Mahol git at videolan.org
Sat Sep 2 22:15:29 EEST 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Sep  2 16:17:00 2023 +0200| [fb06a443609817ce9883cf37d0af78de4d27c992] | committer: Paul B Mahol

avformat/wavarc: fix data end calculation

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fb06a443609817ce9883cf37d0af78de4d27c992
---

 libavformat/wavarc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/wavarc.c b/libavformat/wavarc.c
index 2b5d1b99eb..542a2abbc1 100644
--- a/libavformat/wavarc.c
+++ b/libavformat/wavarc.c
@@ -70,8 +70,10 @@ static int wavarc_read_header(AVFormatContext *s)
     if (avio_r8(pb))
         return AVERROR_INVALIDDATA;
     id = avio_rl32(pb);
+    w->data_end = avio_tell(pb);
     if (avio_read(pb, data, sizeof(data)) != sizeof(data))
         return AVERROR(EIO);
+    w->data_end += 16LL + AV_RL32(data + 4);
     fmt_len = AV_RL32(data + 32);
     if (fmt_len < 12)
         return AVERROR_INVALIDDATA;
@@ -98,8 +100,7 @@ static int wavarc_read_header(AVFormatContext *s)
         if (id != MKTAG('d','a','t','a'))
             avio_skip(pb, avio_rl32(pb));
     } while (id != MKTAG('d','a','t','a') && !avio_feof(pb));
-    w->data_end = avio_rl32(pb);
-    w->data_end += avio_tell(pb);
+    avio_skip(pb, 4);
 
     if (AV_RL32(par->extradata + 16) != MKTAG('R','I','F','F'))
         return AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list