[FFmpeg-devel] [PATCH v5 1/6] avformat/apm: use new extradata format
Michael Niedermayer
michael at niedermayer.cc
Mon Jul 6 19:29:57 EEST 2020
On Mon, Jul 06, 2020 at 09:24:20AM +0000, Zane van Iperen wrote:
> Signed-off-by: Zane van Iperen <zane at zanevaniperen.com>
> ---
> libavformat/Makefile | 2 +-
> libavformat/apm.c | 62 ++++++++++++++++++++++++--------------------
> 2 files changed, 35 insertions(+), 29 deletions(-)
I think the commit message should be more elaborate
"avformat/apm: use new extradata format"
doesnt really say what changes, why its changes
[...]
> @@ -95,24 +99,29 @@ static int apm_read_header(AVFormatContext *s)
> int64_t ret;
> AVStream *st;
> APMVS12Chunk vs12;
> - uint8_t buf[APM_VS12_CHUNK_SIZE];
> + uint8_t buf[APM_FILE_EXTRADATA_SIZE];
>
> if (!(st = avformat_new_stream(s, NULL)))
> return AVERROR(ENOMEM);
>
> - /* The header starts with a WAVEFORMATEX */
> - if ((ret = ff_get_wav_header(s, s->pb, st->codecpar, APM_FILE_HEADER_SIZE, 0)) < 0)
> - return ret;
> -
> - if (st->codecpar->bits_per_coded_sample != 4)
> + /*
> + * This is 98% a WAVEFORMATEX, but there's something screwy with the extradata
> + * that ff_get_wav_header() can't (and shouldn't) handle properly.
> + */
> + if (avio_rl16(s->pb) != APM_TAG_CODEC)
> return AVERROR_INVALIDDATA;
>
> - if (st->codecpar->codec_tag != APM_TAG_CODEC)
> + st->codecpar->channels = avio_rl16(s->pb);
> + st->codecpar->sample_rate = avio_rl32(s->pb);
> + st->codecpar->bit_rate = avio_rl32(s->pb) * 8;
This can overflow
You also may want to add yourself to the MAINTAINERs file
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200706/f2b92ec9/attachment.sig>
More information about the ffmpeg-devel
mailing list