X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fffv1dec_template.c;h=37df7667737d3185f14b1f1e0c8fca6afd07f51a;hb=b9f92093a10217b14d923220aaa186f41a0cf555;hp=21af155bba2e06d439565df7a09041a17e2aec62;hpb=b010843594fee88a791185b83684e0e725007b7b;p=ffmpeg diff --git a/libavcodec/ffv1dec_template.c b/libavcodec/ffv1dec_template.c index 21af155bba2..37df7667737 100644 --- a/libavcodec/ffv1dec_template.c +++ b/libavcodec/ffv1dec_template.c @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -static av_always_inline void RENAME(decode_line)(FFV1Context *s, int w, +static av_always_inline int RENAME(decode_line)(FFV1Context *s, int w, TYPE *sample[2], int plane_index, int bits) { @@ -31,6 +31,9 @@ static av_always_inline void RENAME(decode_line)(FFV1Context *s, int w, int run_mode = 0; int run_index = s->run_index; + if (is_input_end(s)) + return AVERROR_INVALIDDATA; + if (s->slice_coding_mode == 1) { int i; for (x = 0; x < w; x++) { @@ -41,7 +44,7 @@ static av_always_inline void RENAME(decode_line)(FFV1Context *s, int w, } sample[1][x] = v; } - return; + return 0; } for (x = 0; x < w; x++) { @@ -96,11 +99,12 @@ static av_always_inline void RENAME(decode_line)(FFV1Context *s, int w, } if (sign) - diff = -diff; + diff = -(unsigned)diff; - sample[1][x] = av_mod_uintp2(RENAME(predict)(sample[1] + x, sample[0] + x) + diff, bits); + sample[1][x] = av_mod_uintp2(RENAME(predict)(sample[1] + x, sample[0] + x) + (SUINT)diff, bits); } s->run_index = run_index; + return 0; } static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[3], int w, int h, int stride[3]) @@ -149,7 +153,7 @@ static void RENAME(decode_rgb_frame)(FFV1Context *s, uint8_t *src[3], int w, int } if (lbd) - *((uint32_t*)(src[0] + x*4 + stride[0]*y)) = b + (g<<8) + (r<<16) + (a<<24); + *((uint32_t*)(src[0] + x*4 + stride[0]*y)) = b + ((unsigned)g<<8) + ((unsigned)r<<16) + ((unsigned)a<<24); else if (sizeof(TYPE) == 4) { *((uint16_t*)(src[0] + x*2 + stride[0]*y)) = g; *((uint16_t*)(src[1] + x*2 + stride[1]*y)) = b;