Fixes reading from freed data
Fixes part of Ticket3539
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1c55d0ff3202a04ebc67a72d72391104e9bdb633)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a9734e7d3017ffc9539eaac2a8acce3ad427f746)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -353,11 +353,15 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) |
353 | 353 |
avpriv_set_pts_info(vst, 64, 256, swf->frame_rate); |
354 | 354 |
st = vst; |
355 | 355 |
} |
356 |
- st->codec->width = width; |
|
357 |
- st->codec->height = height; |
|
358 | 356 |
|
359 | 357 |
if ((res = av_new_packet(pkt, out_len - colormapsize * colormapbpp)) < 0) |
360 | 358 |
goto bitmap_end; |
359 |
+ if (!st->codec->width && !st->codec->height) { |
|
360 |
+ st->codec->width = width; |
|
361 |
+ st->codec->height = height; |
|
362 |
+ } else { |
|
363 |
+ ff_add_param_change(pkt, 0, 0, 0, width, height); |
|
364 |
+ } |
|
361 | 365 |
pkt->pos = pos; |
362 | 366 |
pkt->stream_index = st->index; |
363 | 367 |
|