[FFmpeg-cvslog] r17193 - trunk/libavformat/adtsenc.c
Alex Converse
alex.converse
Fri Feb 13 02:47:18 CET 2009
On Thu, Feb 12, 2009 at 6:51 PM, superdump <subversion at mplayerhq.hu> wrote:
> Author: superdump
> Date: Fri Feb 13 00:51:08 2009
> New Revision: 17193
>
> Log:
> ADTS Muxer: Refuse to write illegal ADTS files by checking validity of header
> members and erroring out if invalid
>
> Patch by Alex Converse ( alex converse gmail com )
>
> Modified:
> trunk/libavformat/adtsenc.c
>
> Modified: trunk/libavformat/adtsenc.c
> ==============================================================================
> --- trunk/libavformat/adtsenc.c Fri Feb 13 00:48:07 2009 (r17192)
> +++ trunk/libavformat/adtsenc.c Fri Feb 13 00:51:08 2009 (r17193)
> @@ -32,7 +32,7 @@ typedef struct {
> int channel_conf;
> } ADTSContext;
>
> -static int decode_extradata(ADTSContext *adts, uint8_t *buf, int size)
> +static int decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf, int size)
> {
> GetBitContext gb;
>
> @@ -41,6 +41,19 @@ static int decode_extradata(ADTSContext
> adts->sample_rate_index = get_bits(&gb, 4);
> adts->channel_conf = get_bits(&gb, 4);
>
> + if (adts->objecttype > 3) {
> + av_log(s, AV_LOG_ERROR, "MPEG-4 AOT %d is not allowed in ADTS\n", adts->objecttype);
> + return -1;
> + }
Sorry to bother you again, I should have caught this the first time
but when printing the error we refer to MPEG-4 AOTs so we should use
the MPEG-4 numbers not the ADTS numbers or the text should be revised.
> + if (adts->sample_rate_index == 15) {
> + av_log(s, AV_LOG_ERROR, "Escape sample rate index illegal in ADTS\n");
> + return -1;
> + }
> + if (adts->channel_conf == 0) {
> + ff_log_missing_feature(s, "PCE based channel configuration", 0);
> + return -1;
> + }
> +
> adts->write_adts = 1;
>
> return 0;
> @@ -51,8 +64,9 @@ static int adts_write_header(AVFormatCon
> ADTSContext *adts = s->priv_data;
> AVCodecContext *avc = s->streams[0]->codec;
>
> - if(avc->extradata_size > 0)
> - decode_extradata(adts, avc->extradata, avc->extradata_size);
> + if(avc->extradata_size > 0 &&
> + decode_extradata(s, adts, avc->extradata, avc->extradata_size) < 0)
> + return -1;
>
> return 0;
> }
> _______________________________________________
> ffmpeg-cvslog mailing list
> ffmpeg-cvslog at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-cvslog
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aot_plus_one.diff
Type: text/x-diff
Size: 581 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20090212/3bce53d4/attachment.diff>
More information about the ffmpeg-cvslog
mailing list