summaryrefslogtreecommitdiff
path: root/libavcodec/libmp3lame.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-23 03:34:13 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-23 03:34:13 +0200
commitca350378de061a43d394dab2a649995f7f83274c (patch)
treeb30092dc6dcd9d1b1600e184a9820b1c7ccef554 /libavcodec/libmp3lame.c
parent2bcf34a0ef60b8026d9f10fafda9b61ad302b85a (diff)
parentf2f2e7627f0c878d13275af5d166ec5932665e28 (diff)
Merge commit 'f2f2e7627f0c878d13275af5d166ec5932665e28'
* commit 'f2f2e7627f0c878d13275af5d166ec5932665e28': Check mp3 header before calling avpriv_mpegaudio_decode_header(). Conflicts: libavformat/mp3enc.c See: 2dd0da787ce5008d4d1b8f461fbd1288c32e2c38 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libmp3lame.c')
-rw-r--r--libavcodec/libmp3lame.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
index a8c39cc6c7..fed82e271e 100644
--- a/libavcodec/libmp3lame.c
+++ b/libavcodec/libmp3lame.c
@@ -183,6 +183,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
MPADecodeHeader hdr;
int len, ret, ch;
int lame_result;
+ uint32_t h;
if (frame) {
switch (avctx->sample_fmt) {
@@ -240,7 +241,12 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
determine the frame size. */
if (s->buffer_index < 4)
return 0;
- if (avpriv_mpegaudio_decode_header(&hdr, AV_RB32(s->buffer))) {
+ h = AV_RB32(s->buffer);
+ if (ff_mpa_check_header(h) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid mp3 header at start of buffer\n");
+ return AVERROR_BUG;
+ }
+ if (avpriv_mpegaudio_decode_header(&hdr, h)) {
av_log(avctx, AV_LOG_ERROR, "free format output not supported\n");
return -1;
}