diff options
author | Andreas Rheinhardt <[email protected]> | 2025-04-28 11:25:26 +0200 |
---|---|---|
committer | Andreas Rheinhardt <[email protected]> | 2025-04-30 23:33:39 +0200 |
commit | 8279d02cf1998ec324b7624dc41ed15dc2b01cae (patch) | |
tree | 05deec2b550a5526c4d14c93bd08cad2306e449d | |
parent | 0a12b84d3b4025d55c443e5356d6eba546bcc1bb (diff) |
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 <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>
-rw-r--r-- | libavformat/apvdec.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/apvdec.c b/libavformat/apvdec.c index 9f94a901ec..300ee77316 100644 --- a/libavformat/apvdec.c +++ b/libavformat/apvdec.c @@ -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 = { |