avcodec/avcodec: fix UB NULL+0

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
Zhao Zhili 2023-04-12 01:49:26 +08:00
parent ad417eb5fa
commit 36a56d3cc8

View File

@ -44,10 +44,11 @@
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
{
int i;
size_t i;
for (i = 0; i < count; i++) {
int r = func(c, (char *)arg + i * size);
size_t offset = i * size;
int r = func(c, FF_PTR_ADD((char *)arg, offset));
if (ret)
ret[i] = r;
}