If the apperture window is bigger than the canvas, then the clap box is invalid and there's no point calculating cropping values. Fixes: libavformat/mov.c:1295:14: runtime error: -256 is outside the range of representable values of type 'unsigned long'
Unified · Split
| @@ -1277,6 +1277,11 @@ static int mov_read_clap(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 1276 unmodified lines | ||
| 1277 | 1277 | err = AVERROR_INVALIDDATA; |
| 1278 | 1278 | goto fail; |
| 1279 | 1279 | } |
| 1280 | + if ((av_cmp_q((AVRational) { width, 1 }, aperture_width) < 0) || | |
| 1281 | + (av_cmp_q((AVRational) { height, 1 }, aperture_height) < 0)) { | |
| 1282 | + err = AVERROR_INVALIDDATA; | |
| 1283 | + goto fail; | |
| 1284 | + } | |
| 1280 | 1285 | av_log(c->fc, AV_LOG_TRACE, "clap: apertureWidth %d/%d, apertureHeight %d/%d " |
| 1281 | 1286 | "horizOff %d/%d vertOff %d/%d\n", |
| 1282 | 1287 | aperture_width.num, aperture_width.den, aperture_height.num, aperture_height.den, |