X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Flxfdec.c;h=ebb745d3607ce6d24fdc2a8bfe54fa8e893d34a5;hb=bc70684e74a185d7b80c8b80bdedda659cb581b8;hp=9b3eb6a6505db820c7fdd5ba29947dfdf894b5e5;hpb=d0c43e32427ec1efac364be0987a6aafa695527f;p=ffmpeg diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c index 9b3eb6a6505..ebb745d3607 100644 --- a/libavformat/lxfdec.c +++ b/libavformat/lxfdec.c @@ -52,7 +52,7 @@ typedef struct LXFDemuxContext { uint32_t video_format, packet_type, extended_size; } LXFDemuxContext; -static int lxf_probe(AVProbeData *p) +static int lxf_probe(const AVProbeData *p) { if (!memcmp(p->buf, LXF_IDENT, LXF_IDENT_LENGTH)) return AVPROBE_SCORE_MAX; @@ -195,7 +195,7 @@ static int get_packet_header(AVFormatContext *s) return AVERROR_PATCHWELCOME; } - samples = track_size * 8 / st->codecpar->bits_per_coded_sample; + samples = track_size * 8LL / st->codecpar->bits_per_coded_sample; //use audio packet size to determine video standard //for NTSC we have one 8008-sample audio frame per five video frames @@ -210,6 +210,8 @@ static int get_packet_header(AVFormatContext *s) avpriv_set_pts_info(s->streams[0], 64, 1, 25); } + if (av_popcount(channels) * (uint64_t)track_size > INT_MAX) + return AVERROR_INVALIDDATA; //TODO: warning if track mask != (1 << channels) - 1? ret = av_popcount(channels) * track_size; @@ -316,7 +318,6 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt) return ret2; if ((ret2 = avio_read(pb, pkt->data, ret)) != ret) { - av_packet_unref(pkt); return ret2 < 0 ? ret2 : AVERROR_EOF; } @@ -333,7 +334,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -AVInputFormat ff_lxf_demuxer = { +const AVInputFormat ff_lxf_demuxer = { .name = "lxf", .long_name = NULL_IF_CONFIG_SMALL("VR native stream (LXF)"), .priv_data_size = sizeof(LXFDemuxContext),