avcodec/avcodec: fix UB NULL+0

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
pull/389/head
Zhao Zhili 2 years ago
parent ad417eb5fa
commit 36a56d3cc8
  1. 5
      libavcodec/avcodec.c

@ -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 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++) { 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) if (ret)
ret[i] = r; ret[i] = r;
} }

Loading…
Cancel
Save