Commit bdf83185 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'c918e08b'

* commit 'c918e08b':
  truemotion1: make sure index does not go out of bounds

See: fd4c1c0bMerged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 4b3b702f c918e08b
...@@ -519,11 +519,16 @@ hres,vres,i,i%vres (0 < i < 4) ...@@ -519,11 +519,16 @@ hres,vres,i,i%vres (0 < i < 4)
index = s->index_stream[index_stream_index++] * 4; \ index = s->index_stream[index_stream_index++] * 4; \
} }
#define APPLY_C_PREDICTOR() \ #define INC_INDEX \
if(index > 1023){\ do { \
av_log(s->avctx, AV_LOG_ERROR, " index %d went out of bounds\n", index); \ if (index >= 1023) { \
av_log(s->avctx, AV_LOG_ERROR, "Invalid index value.\n"); \
return; \ return; \
}\ } \
index++; \
} while (0)
#define APPLY_C_PREDICTOR() \
predictor_pair = s->c_predictor_table[index]; \ predictor_pair = s->c_predictor_table[index]; \
horiz_pred += (predictor_pair >> 1); \ horiz_pred += (predictor_pair >> 1); \
if (predictor_pair & 1) { \ if (predictor_pair & 1) { \
...@@ -535,16 +540,12 @@ hres,vres,i,i%vres (0 < i < 4) ...@@ -535,16 +540,12 @@ hres,vres,i,i%vres (0 < i < 4)
if (predictor_pair & 1) \ if (predictor_pair & 1) \
GET_NEXT_INDEX() \ GET_NEXT_INDEX() \
else \ else \
index++; \ INC_INDEX; \
} \ } \
} else \ } else \
index++; INC_INDEX;
#define APPLY_C_PREDICTOR_24() \ #define APPLY_C_PREDICTOR_24() \
if(index > 1023){\
av_log(s->avctx, AV_LOG_ERROR, " index %d went out of bounds\n", index); \
return; \
}\
predictor_pair = s->c_predictor_table[index]; \ predictor_pair = s->c_predictor_table[index]; \
horiz_pred += (predictor_pair >> 1); \ horiz_pred += (predictor_pair >> 1); \
if (predictor_pair & 1) { \ if (predictor_pair & 1) { \
...@@ -556,17 +557,13 @@ hres,vres,i,i%vres (0 < i < 4) ...@@ -556,17 +557,13 @@ hres,vres,i,i%vres (0 < i < 4)
if (predictor_pair & 1) \ if (predictor_pair & 1) \
GET_NEXT_INDEX() \ GET_NEXT_INDEX() \
else \ else \
index++; \ INC_INDEX; \
} \ } \
} else \ } else \
index++; INC_INDEX;
#define APPLY_Y_PREDICTOR() \ #define APPLY_Y_PREDICTOR() \
if(index > 1023){\
av_log(s->avctx, AV_LOG_ERROR, " index %d went out of bounds\n", index); \
return; \
}\
predictor_pair = s->y_predictor_table[index]; \ predictor_pair = s->y_predictor_table[index]; \
horiz_pred += (predictor_pair >> 1); \ horiz_pred += (predictor_pair >> 1); \
if (predictor_pair & 1) { \ if (predictor_pair & 1) { \
...@@ -578,16 +575,12 @@ hres,vres,i,i%vres (0 < i < 4) ...@@ -578,16 +575,12 @@ hres,vres,i,i%vres (0 < i < 4)
if (predictor_pair & 1) \ if (predictor_pair & 1) \
GET_NEXT_INDEX() \ GET_NEXT_INDEX() \
else \ else \
index++; \ INC_INDEX; \
} \ } \
} else \ } else \
index++; INC_INDEX;
#define APPLY_Y_PREDICTOR_24() \ #define APPLY_Y_PREDICTOR_24() \
if(index > 1023){\
av_log(s->avctx, AV_LOG_ERROR, " index %d went out of bounds\n", index); \
return; \
}\
predictor_pair = s->y_predictor_table[index]; \ predictor_pair = s->y_predictor_table[index]; \
horiz_pred += (predictor_pair >> 1); \ horiz_pred += (predictor_pair >> 1); \
if (predictor_pair & 1) { \ if (predictor_pair & 1) { \
...@@ -599,10 +592,10 @@ hres,vres,i,i%vres (0 < i < 4) ...@@ -599,10 +592,10 @@ hres,vres,i,i%vres (0 < i < 4)
if (predictor_pair & 1) \ if (predictor_pair & 1) \
GET_NEXT_INDEX() \ GET_NEXT_INDEX() \
else \ else \
index++; \ INC_INDEX; \
} \ } \
} else \ } else \
index++; INC_INDEX;
#define OUTPUT_PIXEL_PAIR() \ #define OUTPUT_PIXEL_PAIR() \
*current_pixel_pair = *vert_pred + horiz_pred; \ *current_pixel_pair = *vert_pred + horiz_pred; \
......
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