diff mbox series

[FFmpeg-devel,v4,7/9] avformat/wavdec: fix s337m/spdif probing beyond data_end

Message ID 20201002222346.1196-8-nicolas.gaullier@cji.paris
State Superseded
Headers show
Series avformat: wav-s337m support + new probe_stream option
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Nicolas Gaullier Oct. 2, 2020, 10:23 p.m. UTC
---
 libavformat/wavdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 5b287680e2..9f48ff067b 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -80,7 +80,7 @@  static void set_spdif_s337m(AVFormatContext *s, WAVDemuxContext *wav)
                 ret = AVERROR(ENOMEM);
             } else {
                 int64_t pos = avio_tell(s->pb);
-                len = ret = avio_read(s->pb, buf, len);
+                len = ret = avio_read(s->pb, buf, FFMIN(len, wav->data_end - pos));
                 if (len >= 0) {
                     if (CONFIG_SPDIF_DEMUXER) {
                         ret = ff_spdif_probe(buf, len, &codec);