diff options
author | Zhao Zhili <zhilizhao@tencent.com> | 2023-04-12 01:49:26 +0800 |
---|---|---|
committer | Zhao Zhili <zhilizhao@tencent.com> | 2023-05-04 12:10:11 +0800 |
commit | 36a56d3cc8dcc137df668e4f2c57d8d9f6310420 (patch) | |
tree | ab0d6eda259f26be6089e92e26be16d0dffba398 /libavcodec | |
parent | ad417eb5fa1c3edf3294ea8db9df87f8a7409297 (diff) | |
download | ffmpeg-36a56d3cc8dcc137df668e4f2c57d8d9f6310420.tar.gz |
avcodec/avcodec: fix UB NULL+0
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/avcodec.c | 5 |
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; } |