History

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.

Leo Izen committed 1 year ago

Commit 3380c0d1 parent 4401e4b1 file · +7 −2Browse files

Unified · Split

libavutil/frame.c+7−2
@@ -1095,6 +1095,7 @@ int av_frame_apply_cropping(AVFrame *frame, int flags) · 1094 unmodified lines
10951095 {
10961096 const AVPixFmtDescriptor *desc;
10971097 size_t offsets[4];
1098+ int ret;
10981099
10991100 if (!(frame->width > 0 && frame->height > 0))
11001101 return AVERROR(EINVAL);
@@ -1122,7 +1123,9 @@ int av_frame_apply_cropping(AVFrame *frame, int flags) · 21 unmodified lines
11221123 }
11231124
11241125 /* calculate the offsets for each plane */
1125− calc_cropping_offsets(offsets, frame, desc);
1126+ ret = calc_cropping_offsets(offsets, frame, desc);
1127+ if (ret < 0)
1128+ return ret;
11261129
11271130 /* adjust the offsets to avoid breaking alignment */
11281131 if (!(flags & AV_FRAME_CROP_UNALIGNED)) {
@@ -1141,7 +1144,9 @@ int av_frame_apply_cropping(AVFrame *frame, int flags) · 12 unmodified lines
11411144
11421145 if (min_log2_align < 5 && log2_crop_align != INT_MAX) {
11431146 frame->crop_left &= ~((1 << (5 + log2_crop_align - min_log2_align)) - 1);
1144− calc_cropping_offsets(offsets, frame, desc);
1147+ ret = calc_cropping_offsets(offsets, frame, desc);
1148+ if (ret < 0)
1149+ return ret;
11451150 }
11461151 }
11471152

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t