Found by reviewing CID1513722 Operands don't affect result
Unified · Split
| @@ -114,7 +114,7 @@ int ff_scale_adjust_dimensions(AVFilterLink *inlink, · 113 unmodified lines | ||
| 114 | 114 | int *ret_w, int *ret_h, |
| 115 | 115 | int force_original_aspect_ratio, int force_divisible_by) |
| 116 | 116 | { |
| 117 | − int w, h; | |
| 117 | + int64_t w, h; | |
| 118 | 118 | int factor_w, factor_h; |
| 119 | 119 | |
| 120 | 120 | w = *ret_w; |
| @@ -149,9 +149,9 @@ int ff_scale_adjust_dimensions(AVFilterLink *inlink, · 28 unmodified lines | ||
| 149 | 149 | * unless force_divisible_by is defined as well */ |
| 150 | 150 | if (force_original_aspect_ratio) { |
| 151 | 151 | // Including force_divisible_by here rounds to the nearest multiple of it. |
| 152 | − int tmp_w = av_rescale(h, inlink->w, inlink->h * (int64_t)force_divisible_by) | |
| 152 | + int64_t tmp_w = av_rescale(h, inlink->w, inlink->h * (int64_t)force_divisible_by) | |
| 153 | 153 | * force_divisible_by; |
| 154 | − int tmp_h = av_rescale(w, inlink->h, inlink->w * (int64_t)force_divisible_by) | |
| 154 | + int64_t tmp_h = av_rescale(w, inlink->h, inlink->w * (int64_t)force_divisible_by) | |
| 155 | 155 | * force_divisible_by; |
| 156 | 156 | |
| 157 | 157 | if (force_original_aspect_ratio == 1) { |
| @@ -173,6 +173,9 @@ int ff_scale_adjust_dimensions(AVFilterLink *inlink, · 15 unmodified lines | ||
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | + if ((int32_t)w != w || (int32_t)h != h) | |
| 177 | + return AVERROR(EINVAL); | |
| 178 | + | |
| 176 | 179 | *ret_w = w; |
| 177 | 180 | *ret_h = h; |
| 178 | 181 | |
| @@ -41,7 +41,7 @@ int ff_scale_eval_dimensions(void *ctx, · 40 unmodified lines | ||
| 41 | 41 | * force_original_aspect_ratio is set. force_divisible_by is used only when |
| 42 | 42 | * force_original_aspect_ratio is set and must be at least 1. |
| 43 | 43 | * |
| 44 | − * Returns 0. | |
| 44 | + * Returns negative error code on error or non negative on success | |
| 45 | 45 | */ |
| 46 | 46 | int ff_scale_adjust_dimensions(AVFilterLink *inlink, |
| 47 | 47 | int *ret_w, int *ret_h, |