aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhao Zhili <zhilizhao@tencent.com>2023-04-12 01:49:26 +0800
committerZhao Zhili <zhilizhao@tencent.com>2023-05-04 12:10:11 +0800
commit36a56d3cc8dcc137df668e4f2c57d8d9f6310420 (patch)
treeab0d6eda259f26be6089e92e26be16d0dffba398
parentad417eb5fa1c3edf3294ea8db9df87f8a7409297 (diff)
downloadffmpeg-36a56d3cc8dcc137df668e4f2c57d8d9f6310420.tar.gz
avcodec/avcodec: fix UB NULL+0
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
-rw-r--r--libavcodec/avcodec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index fb1362290f..5a96899d50 100644
--- a/libavcodec/avcodec.c
+++ b/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 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;
}