avformat/mp3enc: Assert that the header we assembled is valid
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 3 Feb 2016 23:20:51 +0000 (00:20 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 7 Feb 2016 00:12:48 +0000 (01:12 +0100)
Silences: CID1351343

The header is calculated by the code above the changed hunk, it is
thus asserted that the header is always correct.

Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mp3enc.c

index 7296234..71f5178 100644 (file)
@@ -192,7 +192,8 @@ static int mp3_write_xing(AVFormatContext *s)
             return -1;
         header |= mask;
 
-        avpriv_mpegaudio_decode_header(&mpah, header);
+        ret = avpriv_mpegaudio_decode_header(&mpah, header);
+        av_assert0(ret >= 0);
         mp3->xing_offset = xing_offtbl[mpah.lsf == 1][mpah.nb_channels == 1] + 4;
         bytes_needed     = mp3->xing_offset + XING_SIZE;