Commit 98315edc authored by alexc's avatar alexc

Move the SBR patch count check to prevent overwrites.

Thanks to Chromium.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22999 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 8f55d905
...@@ -519,6 +519,15 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr) ...@@ -519,6 +519,15 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
odd = (sb + sbr->k[0]) & 1; 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_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]; 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) ...@@ -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) if (sbr->patch_num_subbands[sbr->num_patches-1] < 3 && sbr->num_patches > 1)
sbr->num_patches--; 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment