[FFmpeg-cvslog] avformat/mp3dec: fix msan warning when verifying mpa header

Chris Cunningham git at videolan.org
Thu Jan 26 02:14:34 EET 2017


ffmpeg | branch: release/3.2 | Chris Cunningham <chcunningham at chromium.org> | Tue Nov 22 13:54:50 2016 -0800| [533431d5af927012812c9c52b710cd796f7c022c] | committer: Michael Niedermayer

avformat/mp3dec: fix msan warning when verifying mpa header

MPEG Audio frame header must be 4 bytes. If we fail to read
4 bytes bail early to avoid Use-of-uninitialized-value msan error.
Reference https://crbug.com/666874.

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit ab87df9a47cd31bfcae9acd84c04705a149dfc14)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/mp3dec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 56c7f8c..099ca57 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -457,7 +457,8 @@ static int check(AVIOContext *pb, int64_t pos, uint32_t *ret_header)
         return CHECK_SEEK_FAILED;
 
     ret = avio_read(pb, &header_buf[0], 4);
-    if (ret < 0)
+    /* We should always find four bytes for a valid mpa header. */
+    if (ret < 4)
         return CHECK_SEEK_FAILED;
 
     header = AV_RB32(&header_buf[0]);



More information about the ffmpeg-cvslog mailing list