Commit 130c6497 authored by Stefano Sabatini's avatar Stefano Sabatini

lavfi/alphaextract: fix assignment of invalid size value to memcpy in case linesize < 0

Fix crash, for example in the command:
ffmpeg -f image2 -vcodec pgmyuv -i tests/vsynth1/%02d.pgm \
  -vf "[in]format=yuv420p,split,alphamerge,split[o3][o4];
       [o4]vflip,alphaextract[alpha];[o3][alpha]alphamerge[out]" \
  -vcodec rawvideo -f nut md5:
parent c3ad91a3
......@@ -87,7 +87,7 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *cur_buf)
}
}
} else {
const int linesize = FFMIN(out_buf->linesize[Y], cur_buf->linesize[A]);
const int linesize = abs(FFMIN(out_buf->linesize[Y], cur_buf->linesize[A]));
int y;
for (y = 0; y < out_buf->video->h; y++) {
memcpy(out_buf->data[Y] + y * out_buf->linesize[Y],
......
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