You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avformat/apvdec: Check before access
The signature check would segfault in case the packet could not be allocated or if nothing could be read. Furthermore, read_packet callbacks are supposed to return zero on success, yet the current code returned the size of the packet. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -225,7 +225,9 @@ static int apv_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
}
|
||||
|
||||
ret = av_get_packet(s->pb, pkt, au_size);
|
||||
pkt->flags = AV_PKT_FLAG_KEY;
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
pkt->flags = AV_PKT_FLAG_KEY;
|
||||
|
||||
signature = AV_RB32(pkt->data);
|
||||
if (signature != APV_SIGNATURE) {
|
||||
@@ -233,7 +235,7 @@ static int apv_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const FFInputFormat ff_apv_demuxer = {
|
||||
|
Reference in New Issue
Block a user