*/
#include "libavutil/intreadwrite.h"
-#include "libavutil/mathematics.h"
#include "libavutil/dict.h"
#include "avformat.h"
#include "internal.h"
#include "pcm.h"
#include "aiff.h"
-#include "isom.h"
#include "id3v2.h"
#include "mov_chan.h"
#include "replaygain.h"
else
sample_rate = (val + (1ULL<<(-exp-1))) >> -exp;
par->sample_rate = sample_rate;
+ if (size < 18)
+ return AVERROR_INVALIDDATA;
size -= 18;
/* get codec id for AIFF-C */
AVIOContext *pb = s->pb;
AVStream * st;
AIFFInputContext *aiff = s->priv_data;
- ID3v2ExtraMeta *id3v2_extra_meta = NULL;
+ ID3v2ExtraMeta *id3v2_extra_meta;
/* check FORM header */
filesize = get_tag(pb, &tag);
get_meta(s, "comment" , size);
break;
case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */
+ if (size < 8)
+ return AVERROR_INVALIDDATA;
aiff->data_end = avio_tell(pb) + size;
offset = avio_rb32(pb); /* Offset of sound data */
avio_rb32(pb); /* BlockSize... don't care */
break;
default:
size = st->codecpar->block_align ? (MAX_SIZE / st->codecpar->block_align) * st->codecpar->block_align : MAX_SIZE;
+ if (!size)
+ return AVERROR_INVALIDDATA;
}
size = FFMIN(max_size, size);
res = av_get_packet(s->pb, pkt, size);
return 0;
}
-AVInputFormat ff_aiff_demuxer = {
+const AVInputFormat ff_aiff_demuxer = {
.name = "aiff",
.long_name = NULL_IF_CONFIG_SMALL("Audio IFF"),
.priv_data_size = sizeof(AIFFInputContext),
.read_header = aiff_read_header,
.read_packet = aiff_read_packet,
.read_seek = ff_pcm_read_seek,
- .codec_tag = (const AVCodecTag* const []){ ff_codec_aiff_tags, 0 },
+ .codec_tag = ff_aiff_codec_tags_list,
};