diff options
author | Alex Converse <alex.converse@gmail.com> | 2010-04-30 23:08:44 +0000 |
---|---|---|
committer | Alex Converse <alex.converse@gmail.com> | 2010-04-30 23:08:44 +0000 |
commit | a91d82b5cc7d828ea9779aae1595f60e7e257d29 (patch) | |
tree | 154d06dab67e8dd8702666b01b0cf39d1e330cb5 /libavcodec | |
parent | 10678e5c728f3b7c4c8d4aa95df07421da3e14a9 (diff) | |
download | ffmpeg-a91d82b5cc7d828ea9779aae1595f60e7e257d29.tar.gz |
Move the SBR patch count check to prevent overwrites.
Thanks to Chromium.
Originally committed as revision 22999 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/aacsbr.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index ec6f9151b0..bc6cb003cb 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -519,6 +519,15 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr) odd = (sb + sbr->k[0]) & 1; } + // Requirements (14496-3 sp04 p205) sets the maximum number of patches to 5. + // After this check the final number of patches can still be six which is + // illegal however the Coding Technologies decoder check stream has a final + // count of 6 patches + if (sbr->num_patches > 5) { + av_log(ac->avccontext, AV_LOG_ERROR, "Too many patches: %d\n", sbr->num_patches); + return -1; + } + sbr->patch_num_subbands[sbr->num_patches] = FFMAX(sb - usb, 0); sbr->patch_start_subband[sbr->num_patches] = sbr->k[0] - odd - sbr->patch_num_subbands[sbr->num_patches]; @@ -536,13 +545,6 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr) if (sbr->patch_num_subbands[sbr->num_patches-1] < 3 && sbr->num_patches > 1) sbr->num_patches--; - // Requirements (14496-3 sp04 p205) sets the maximum number of patches to 5 - // However the Coding Technologies decoder check uses 6 patches - if (sbr->num_patches > 6) { - av_log(ac->avccontext, AV_LOG_ERROR, "Too many patches: %d\n", sbr->num_patches); - return -1; - } - return 0; } |