Mercurial > libavformat.hg
changeset 5041:573d181e477c libavformat
Set restrictions on packet_size, as per ISO-11172 / H-222 specifications
(max packet size should fit in 13 bits as a kB value, so 1<<23, plus the
header which is 10 bytes), and as per mpegenc.c internal assumptions
(min packet size is 20 bytes). See "[PATCH] make packet_size in
AVFormatContext unsigned" thread.
author | rbultje |
---|---|
date | Wed, 17 Jun 2009 19:04:02 +0000 |
parents | 79169d57638b |
children | 05ecbb54e8bf |
files | mpegenc.c |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mpegenc.c Wed Jun 17 07:05:17 2009 +0000 +++ b/mpegenc.c Wed Jun 17 19:04:02 2009 +0000 @@ -304,9 +304,14 @@ (CONFIG_MPEG2SVCD_MUXER && ctx->oformat == &mpeg2svcd_muxer)); s->is_dvd = (CONFIG_MPEG2DVD_MUXER && ctx->oformat == &mpeg2dvd_muxer); - if(ctx->packet_size) + if(ctx->packet_size) { + if (ctx->packet_size < 20 || ctx->packet_size > (1 << 23) + 10) { + av_log(ctx, AV_LOG_ERROR, "Invalid packet size %d\n", + ctx->packet_size); + goto fail; + } s->packet_size = ctx->packet_size; - else + } else s->packet_size = 2048; s->vcd_padding_bytes_written = 0;