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.
Unified · Split
| @@ -1095,6 +1095,7 @@ int av_frame_apply_cropping(AVFrame *frame, int flags) · 1094 unmodified lines | ||
| 1095 | 1095 | { |
| 1096 | 1096 | const AVPixFmtDescriptor *desc; |
| 1097 | 1097 | size_t offsets[4]; |
| 1098 | + int ret; | |
| 1098 | 1099 | |
| 1099 | 1100 | if (!(frame->width > 0 && frame->height > 0)) |
| 1100 | 1101 | return AVERROR(EINVAL); |
| @@ -1122,7 +1123,9 @@ int av_frame_apply_cropping(AVFrame *frame, int flags) · 21 unmodified lines | ||
| 1122 | 1123 | } |
| 1123 | 1124 | |
| 1124 | 1125 | /* 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; | |
| 1126 | 1129 | |
| 1127 | 1130 | /* adjust the offsets to avoid breaking alignment */ |
| 1128 | 1131 | if (!(flags & AV_FRAME_CROP_UNALIGNED)) { |
| @@ -1141,7 +1144,9 @@ int av_frame_apply_cropping(AVFrame *frame, int flags) · 12 unmodified lines | ||
| 1141 | 1144 | |
| 1142 | 1145 | if (min_log2_align < 5 && log2_crop_align != INT_MAX) { |
| 1143 | 1146 | 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; | |
| 1145 | 1150 | } |
| 1146 | 1151 | } |
| 1147 | 1152 | |