mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-03 05:22:10 +00:00
avformat/nutdec: check avio_read() return code
Fixes use of uninitialized memory Fixes: msan_uninit-mem_7f2785ab8669_6838_mewmew_vorbis_ssa.nut Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
523a803b73
commit
71fe97a60a
@ -970,6 +970,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
|
||||
int64_t pts, last_IP_pts;
|
||||
StreamContext *stc;
|
||||
uint8_t header_idx;
|
||||
int ret;
|
||||
|
||||
size = decode_frame_header(nut, &pts, &stream_id, &header_idx, frame_code);
|
||||
if (size < 0)
|
||||
@ -1006,7 +1007,12 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
|
||||
pkt->size -= sm_size;
|
||||
}
|
||||
|
||||
avio_read(bc, pkt->data + nut->header_len[header_idx], size);
|
||||
ret = avio_read(bc, pkt->data + nut->header_len[header_idx], size);
|
||||
if (ret != size) {
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
av_shrink_packet(pkt, nut->header_len[header_idx] + size);
|
||||
}
|
||||
|
||||
pkt->stream_index = stream_id;
|
||||
if (stc->last_flags & FLAG_KEY)
|
||||
|
Loading…
Reference in New Issue
Block a user