aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Converse <alex.converse@gmail.com>2012-02-17 14:13:40 -0800
committerReinhard Tartler <siretart@tauware.de>2012-05-28 20:55:34 +0200
commit654b24f68a803fbc85764899a07294483dccf54f (patch)
tree792005fc2eacfcc3fa26ba26bfbef55d663f6d0a
parent2f2fd8c6d1c51a6b817e6c0bc4eff308b8f9cd18 (diff)
downloadffmpeg-654b24f68a803fbc85764899a07294483dccf54f.tar.gz
dpcm: ignore extra unpaired bytes in stereo streams.
Fixes: CVE-2011-3951 Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind (cherry picked from commit ce7aee9b733134649a6ce2fa743e51733f33e67e) (cherry picked from commit eaeaeb265fe46e1d81452960de918227541873b4) Conflicts: libavcodec/dpcm.c Signed-off-by: Reinhard Tartler <siretart@tauware.de>
-rw-r--r--libavcodec/dpcm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c
index af5bf8abea..9cf924821a 100644
--- a/libavcodec/dpcm.c
+++ b/libavcodec/dpcm.c
@@ -169,6 +169,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
int in, out = 0;
int predictor[2];
int channel_number = 0;
+ int stereo = s->channels - 1;
short *output_samples = data;
int shift[2];
unsigned char byte;
@@ -177,6 +178,9 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
if (!buf_size)
return 0;
+ if (stereo && (buf_size & 1))
+ buf_size--;
+
// almost every DPCM variant expands one byte of data into two
if(*data_size/2 < buf_size)
return -1;
@@ -295,7 +299,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
}
*data_size = out * sizeof(short);
- return buf_size;
+ return avpkt->size;
}
#define DPCM_DECODER(id, name, long_name_) \