On 20.10.2016 02:56, Michael Niedermayer wrote: > On Wed, Oct 19, 2016 at 09:18:51PM +0200, Andreas Cadhalpun wrote: >> This is similar to commit c143a9c. >> >> Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com> >> --- >> libavformat/aiffdec.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > can aiff work without block_align ?
Well, it can use a fall-back value. That value can be wrong, of course. > either way, block_duration is from the header reading > if its still accurate then using it together with 1 instead of the > matching block align is quite likely not correct > OTOH if block_duration does not represent the actual content then > the duration would only be correct by pure chance > > Its a bit unfortunate that theres no usecase with an undamaged sample > which would have clear correct values > > one has to work on the assumptation of a use case where the user needs > to override the codec and then ask "what is correct to do" that makes > this a bit tricky ... Alternatively aiff_read_packet could just error out, if you prefer that. Patch doing that attached. Best regards, Andreas
>From d1edb842a886de0bae6e32ac602f2fef6810081a Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com> Date: Thu, 20 Oct 2016 20:08:15 +0200 Subject: [PATCH] aiff: check block_align in aiff_read_packet It can be unset in avcodec_parameters_from_context and a value of 0 causes SIGFPE crashes. Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com> --- libavformat/aiffdec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index de82787..59e969d 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -371,6 +371,11 @@ static int aiff_read_packet(AVFormatContext *s, if (max_size <= 0) return AVERROR_EOF; + if (!st->codecpar->block_align) { + av_log(s, AV_LOG_ERROR, "block_align not set\n"); + return AVERROR_INVALIDDATA; + } + /* Now for that packet */ switch (st->codecpar->codec_id) { case AV_CODEC_ID_ADPCM_IMA_QT: -- 2.9.3
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel