X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fbrstm.c;h=ca965ed7e1999f8e76d73a75e0e45bfddeea7aed;hb=de0b04551da4e1470ce1c99321a768887df8c650;hp=87690e3f73e421ebf870edc15ae9417bf92ff4c5;hpb=f3881c04e93ee70567bd3fe087f49b996b026d30;p=ffmpeg diff --git a/libavformat/brstm.c b/libavformat/brstm.c index 87690e3f73e..ca965ed7e19 100644 --- a/libavformat/brstm.c +++ b/libavformat/brstm.c @@ -38,7 +38,7 @@ typedef struct BRSTMDemuxContext { int little_endian; } BRSTMDemuxContext; -static int probe(AVProbeData *p) +static int probe(const AVProbeData *p) { if (AV_RL32(p->buf) == MKTAG('R','S','T','M') && (AV_RL16(p->buf + 4) == 0xFFFE || @@ -47,7 +47,7 @@ static int probe(AVProbeData *p) return 0; } -static int probe_bfstm(AVProbeData *p) +static int probe_bfstm(const AVProbeData *p) { if ((AV_RL32(p->buf) == MKTAG('F','S','T','M') || AV_RL32(p->buf) == MKTAG('C','S','T','M')) && @@ -403,8 +403,8 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) (32 + 4 + size) > (INT_MAX / par->channels) || (32 + 4 + size) * par->channels > INT_MAX - 8) return AVERROR_INVALIDDATA; - if (av_new_packet(pkt, 8 + (32 + 4 + size) * par->channels) < 0) - return AVERROR(ENOMEM); + if ((ret = av_new_packet(pkt, 8 + (32 + 4 + size) * par->channels)) < 0) + return ret; dst = pkt->data; if (par->codec_id == AV_CODEC_ID_ADPCM_THP_LE) { bytestream_put_le32(&dst, size * par->channels); @@ -422,8 +422,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) dst += size; avio_skip(s->pb, skip); if (ret != size) { - av_packet_unref(pkt); - break; + return AVERROR(EIO); } } pkt->duration = samples;