aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMashiat Sarker Shakkhar <shahriman_ams@yahoo.com>2011-11-22 01:01:30 +0600
committerMashiat Sarker Shakkhar <shahriman_ams@yahoo.com>2011-11-22 01:01:30 +0600
commit6cf31ef263d36f6b89d9b64f15ca81cef4f24901 (patch)
tree457f1508c08328b4e5ad771d2c7832e4c207b47b /libavcodec
parenta3a8d5e0c1c78cdccc6a25a27b78476cfde32814 (diff)
downloadffmpeg-6cf31ef263d36f6b89d9b64f15ca81cef4f24901.tar.gz
Fix some loop conditions to prevent overreads
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/wmalosslessdec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 5b11d7d4a4..051ad1a9e8 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -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);