History

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.

Andreas Rheinhardt committed 1 year ago

Commit 8279d021 parent 0a12b841 file · +4 −2Browse files

Unified · Split

libavformat/apvdec.c+4−2
@@ -225,7 +225,9 @@ static int apv_read_packet(AVFormatContext *s, AVPacket *pkt) · 224 unmodified lines
225225 }
226226
227227 ret = av_get_packet(s->pb, pkt, au_size);
228− pkt->flags = AV_PKT_FLAG_KEY;
228+ if (ret < 0)
229+ return ret;
230+ pkt->flags = AV_PKT_FLAG_KEY;
229231
230232 signature = AV_RB32(pkt->data);
231233 if (signature != APV_SIGNATURE) {
@@ -233,7 +235,7 @@ static int apv_read_packet(AVFormatContext *s, AVPacket *pkt) · 1 unmodified line
233235 return AVERROR_INVALIDDATA;
234236 }
235237
236− return ret;
238+ return 0;
237239 }
238240
239241 const FFInputFormat ff_apv_demuxer = {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t