aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-09-21 11:49:33 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-10-11 07:48:16 -0400
commitff1f89de2da3472d133e2c95bf7c9ad2d88df33d (patch)
tree303734f60129964be4e31013f71e3b13ef05c100
parentcf044f8bff0d28dbc34492f18b0d18b3ba8bad9d (diff)
downloadffmpeg-ff1f89de2da3472d133e2c95bf7c9ad2d88df33d.tar.gz
smacker: validate channels and sample format.
-rw-r--r--libavcodec/smacker.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 20ddc15915..d8a3d7733b 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -606,6 +606,14 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
av_log(avctx, AV_LOG_ERROR, "Frame is too large to fit in buffer\n");
return -1;
}
+ if (stereo ^ (avctx->channels != 1)) {
+ av_log(avctx, AV_LOG_ERROR, "channels mismatch\n");
+ return AVERROR(EINVAL);
+ }
+ if (bits && avctx->sample_fmt == AV_SAMPLE_FMT_U8) {
+ av_log(avctx, AV_LOG_ERROR, "sample format mismatch\n");
+ return AVERROR(EINVAL);
+ }
memset(vlc, 0, sizeof(VLC) * 4);
memset(h, 0, sizeof(HuffContext) * 4);