lavc/zmbvenc: Do not left-shift negative values.

Fixes the following ubsan errors with the sample from ticket #7980:
libavcodec/zmbvenc.c:243:29: runtime error: left shift of negative value -4
libavcodec/zmbvenc.c:244:28: runtime error: left shift of negative value -2
This commit is contained in:
Carl Eugen Hoyos 2019-07-01 01:45:36 +02:00
parent 686755f02b
commit ea56af8895
1 changed files with 2 additions and 2 deletions

View File

@ -240,8 +240,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
tprev = prev + x * c->bypp; tprev = prev + x * c->bypp;
zmbv_me(c, tsrc, p->linesize[0], tprev, c->pstride, x, y, &mx, &my, &xored); zmbv_me(c, tsrc, p->linesize[0], tprev, c->pstride, x, y, &mx, &my, &xored);
mv[0] = (mx << 1) | !!xored; mv[0] = (mx * 2) | !!xored;
mv[1] = my << 1; mv[1] = my * 2;
tprev += mx * c->bypp + my * c->pstride; tprev += mx * c->bypp + my * c->pstride;
if(xored){ if(xored){
for(j = 0; j < bh2; j++){ for(j = 0; j < bh2; j++){