aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/frame.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-06-03 16:44:08 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-06-06 16:27:12 +0200
commitabebdb1bdb737f92edc88aaea71395649a85e37c (patch)
tree5333467aa47813b846b8b4caf5992880a0428ea0 /libavutil/frame.c
parent4bd1ce31fc72ae153b78b87d791a598f06fead9e (diff)
downloadffmpeg-abebdb1bdb737f92edc88aaea71395649a85e37c.tar.gz
avutil/frame: Always return error upon error
(I don't know whether this can be triggered for a file with nonnegative channel count, given that src's extended data can't have been allocated in this case.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavutil/frame.c')
-rw-r--r--libavutil/frame.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/libavutil/frame.c b/libavutil/frame.c
index dcfc835626..569059c45c 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -456,14 +456,11 @@ int av_frame_replace(AVFrame *dst, const AVFrame *src)
if (src->extended_data != src->data) {
int ch = dst->ch_layout.nb_channels;
- if (!ch) {
+ if (ch <= 0 || ch > SIZE_MAX / sizeof(*dst->extended_data)) {
ret = AVERROR(EINVAL);
goto fail;
}
- if (ch > SIZE_MAX / sizeof(*dst->extended_data))
- goto fail;
-
dst->extended_data = av_memdup(src->extended_data, sizeof(*dst->extended_data) * ch);
if (!dst->extended_data) {
ret = AVERROR(ENOMEM);