summaryrefslogtreecommitdiff
path: root/libavcodec/rv34.c
diff options
context:
space:
mode:
authorJiasheng Jiang <jiasheng@iscas.ac.cn>2023-04-17 10:32:12 +0800
committerJames Almer <jamrial@gmail.com>2023-04-16 23:36:03 -0300
commitf8d0b13de5fe1a3d158dcc6f419c45c368b1dd4f (patch)
tree7e6e8467ed335fbe615c4ef57cc91ee005597bfb /libavcodec/rv34.c
parenta3f49168dcbf3ad7c60db065f40af60427a55a96 (diff)
avcodec/rv34: Add check for av_malloc
Add the check for the return value of the av_malloc in order to avoid NULL pointer deference. Fixes: b86ab38137 ("Add weighted motion compensation for RV40 B-frames") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Diffstat (limited to 'libavcodec/rv34.c')
-rw-r--r--libavcodec/rv34.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 45f64666f8..51f18147af 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1692,6 +1692,8 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, AVFrame *pict,
int i;
r->tmp_b_block_base = av_malloc(s->linesize * 48);
+ if (!r->tmp_b_block_base)
+ return AVERROR(ENOMEM);
for (i = 0; i < 2; i++)
r->tmp_b_block_y[i] = r->tmp_b_block_base
+ i * 16 * s->linesize;