1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Fix some loop conditions to prevent overreads

This commit is contained in:
Mashiat Sarker Shakkhar 2011-11-22 01:01:30 +06:00
parent a3a8d5e0c1
commit 6cf31ef263

View File

@ -857,7 +857,7 @@ static void use_high_update_speed(WmallDecodeCtx *s, int ich)
{
int ilms, recent, icoef;
s->update_speed[ich] = 16;
for (ilms = s->cdlms_ttl[ich]; ilms >= 0; ilms--) {
for (ilms = s->cdlms_ttl[ich] - 1; ilms >= 0; ilms--) {
recent = s->cdlms[ich][ilms].recent;
if (s->bV3RTM) {
for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
@ -873,7 +873,7 @@ static void use_normal_update_speed(WmallDecodeCtx *s, int ich)
{
int ilms, recent, icoef;
s->update_speed[ich] = 8;
for (ilms = s->cdlms_ttl[ich]; ilms >= 0; ilms--) {
for (ilms = s->cdlms_ttl[ich] - 1; ilms >= 0; ilms--) {
recent = s->cdlms[ich][ilms].recent;
if (s->bV3RTM) {
for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
@ -901,7 +901,7 @@ static void revert_cdlms(WmallDecodeCtx *s, int tile_size)
s->transient[ich] = 1;
use_high_update_speed(s, ich);
}
for (ilms = num_lms; ilms >= 0; ilms--) {
for (ilms = num_lms - 1; ilms >= 0; ilms--) {
pred = lms_predict(s, ich, ilms);
channel_coeff += pred;
lms_update(s, ich, ilms, channel_coeff, pred);