Skip to content

Commit

Permalink
avformat/mp3dec: fix msan warning when verifying mpa header
Browse files Browse the repository at this point in the history
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@niedermayer.cc>
(cherry picked from commit ab87df9)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
  • Loading branch information
chcunningham authored and michaelni committed Jan 25, 2017
1 parent 9519b25 commit 533431d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libavformat/mp3dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 533431d

Please sign in to comment.