aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-08-06 09:14:11 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-08-08 11:41:52 +0200
commitd3730acca3a749204f0c312f1be6f4e5f3296f22 (patch)
treec9b2ad94dd0ee0f49251750f75bfbbad11d98e04 /libavcodec
parenteb608fd0b00424eacb4dc85f23227e186289fb48 (diff)
downloadffmpeg-d3730acca3a749204f0c312f1be6f4e5f3296f22.tar.gz
avcodec/nvdec: Check av_buffer_ref()
It (unfortunately) involves an allocation and can therefore fail. Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/nvdec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index edff46d310..15665b83bb 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -532,8 +532,11 @@ static int nvdec_retrieve_data(void *logctx, AVFrame *frame)
}
unmap_data->idx = cf->idx;
- unmap_data->idx_ref = av_buffer_ref(cf->idx_ref);
- unmap_data->decoder_ref = av_buffer_ref(cf->decoder_ref);
+ if (!(unmap_data->idx_ref = av_buffer_ref(cf->idx_ref)) ||
+ !(unmap_data->decoder_ref = av_buffer_ref(cf->decoder_ref))) {
+ ret = AVERROR(ENOMEM);
+ goto copy_fail;
+ }
av_pix_fmt_get_chroma_sub_sample(hwctx->sw_format, &shift_h, &shift_v);
for (i = 0; frame->linesize[i]; i++) {