Fixes out of array access
Fixes: asan_heap-oob_11222fb_21_020.dxa
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e70312dfc22c4e54d5716f28f28db8f99c74cc90)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -329,6 +329,11 @@ static av_cold int decode_init(AVCodecContext *avctx) |
329 | 329 |
{ |
330 | 330 |
DxaDecContext * const c = avctx->priv_data; |
331 | 331 |
|
332 |
+ if (avctx->width%4 || avctx->height%4) { |
|
333 |
+ avpriv_request_sample(avctx, "dimensions are not a multiple of 4"); |
|
334 |
+ return AVERROR_INVALIDDATA; |
|
335 |
+ } |
|
336 |
+ |
|
332 | 337 |
c->prev = av_frame_alloc(); |
333 | 338 |
if (!c->prev) |
334 | 339 |
return AVERROR(ENOMEM); |