aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGoogle Chrome <>2009-09-23 12:09:33 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-09-23 12:09:33 +0000
commite5b0cfb541035967f4b2fcc49a48c1103a8bce62 (patch)
treed7998492534c4538b62d1026db859efb2356803d
parent79a4258141f8d7c68556eec68ddb88ca556f29e0 (diff)
downloadffmpeg-e5b0cfb541035967f4b2fcc49a48c1103a8bce62.tar.gz
Add checks for per-packet mode indexes and per-header mode mapping indexes.
12_vorbis_mode_indexes.patch by chrome maybe exploitable Originally committed as revision 19990 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/vorbis_dec.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c
index 2d5e610da4..ec305ba393 100644
--- a/libavcodec/vorbis_dec.c
+++ b/libavcodec/vorbis_dec.c
@@ -793,7 +793,11 @@ static int vorbis_parse_setup_hdr_modes(vorbis_context *vc) {
mode_setup->blockflag=get_bits1(gb);
mode_setup->windowtype=get_bits(gb, 16); //FIXME check
mode_setup->transformtype=get_bits(gb, 16); //FIXME check
- mode_setup->mapping=get_bits(gb, 8); //FIXME check
+ mode_setup->mapping=get_bits(gb, 8);
+ if (mode_setup->mapping>=vc->mapping_count) {
+ av_log(vc->avccontext, AV_LOG_ERROR, "mode mapping value %d out of range. \n", mode_setup->mapping);
+ return 1;
+ }
AV_DEBUG(" %d mode: blockflag %d, windowtype %d, transformtype %d, mapping %d \n", i, mode_setup->blockflag, mode_setup->windowtype, mode_setup->transformtype, mode_setup->mapping);
}
@@ -1450,6 +1454,10 @@ static int vorbis_parse_audio_packet(vorbis_context *vc) {
} else {
mode_number=get_bits(gb, ilog(vc->mode_count-1));
}
+ if (mode_number>=vc->mode_count) {
+ av_log(vc->avccontext, AV_LOG_ERROR, "mode number %d out of range.\n", mode_number);
+ return -1;
+ }
vc->mode_number=mode_number;
mapping=&vc->mappings[vc->modes[mode_number].mapping];