diff options
author | Leo Izen <leo.izen@gmail.com> | 2025-01-21 07:34:01 -0500 |
---|---|---|
committer | Leo Izen <leo.izen@gmail.com> | 2025-01-28 16:09:56 -0500 |
commit | 3380c0d27df1e07f009e114da98fb8033c2ce33d (patch) | |
tree | f50beeaa5615c20ca4425cf650231c6fb7c154fa /libavutil/frame.c | |
parent | 4401e4b6065ea33d422adaa58692c5a4ba0ec2a4 (diff) | |
download | ffmpeg-3380c0d27df1e07f009e114da98fb8033c2ce33d.tar.gz |
avutil/frame: check return value for cropping offsets
This function can return AVERROR_BUG in theory if something
went wrong, but so can the caller, so we should propagate that
error message upward in that case.
Signed-off-by: Leo Izen <leo.izen@gmail.com>
Diffstat (limited to 'libavutil/frame.c')
-rw-r--r-- | libavutil/frame.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavutil/frame.c b/libavutil/frame.c index 00d0bab8b5..992115e04f 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -1095,6 +1095,7 @@ int av_frame_apply_cropping(AVFrame *frame, int flags) { const AVPixFmtDescriptor *desc; size_t offsets[4]; + int ret; if (!(frame->width > 0 && frame->height > 0)) return AVERROR(EINVAL); @@ -1122,7 +1123,9 @@ int av_frame_apply_cropping(AVFrame *frame, int flags) } /* calculate the offsets for each plane */ - calc_cropping_offsets(offsets, frame, desc); + ret = calc_cropping_offsets(offsets, frame, desc); + if (ret < 0) + return ret; /* adjust the offsets to avoid breaking alignment */ if (!(flags & AV_FRAME_CROP_UNALIGNED)) { @@ -1141,7 +1144,9 @@ int av_frame_apply_cropping(AVFrame *frame, int flags) if (min_log2_align < 5 && log2_crop_align != INT_MAX) { frame->crop_left &= ~((1 << (5 + log2_crop_align - min_log2_align)) - 1); - calc_cropping_offsets(offsets, frame, desc); + ret = calc_cropping_offsets(offsets, frame, desc); + if (ret < 0) + return ret; } } |