[FFmpeg-devel] [PATCH 07/10] asfdec: deobfuscate reading video properties size

Anton Khirnov anton
Wed Feb 9 12:36:45 CET 2011


On Wed, Feb 09, 2011 at 12:27:14PM +0100, Vladimir Pantelic wrote:
> Anton Khirnov wrote:
> >---
> >  libavformat/asfdec.c |    9 ++++-----
> >  1 files changed, 4 insertions(+), 5 deletions(-)
> >
> >diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
> >index dad0f37..3bd57fd 100644
> >--- a/libavformat/asfdec.c
> >+++ b/libavformat/asfdec.c
> >@@ -418,7 +418,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
> >      ByteIOContext *pb = s->pb;
> >      AVStream *st;
> >      ASFStream *asf_st;
> >-    int size, i;
> >+    int i;
> >      int64_t gsize;
> >
> >      ff_get_guid(pb,&g);
> >@@ -579,7 +579,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
> >                  get_le32(pb);
> >                  get_le32(pb);
> >                  get_byte(pb);
> >-                size = get_le16(pb); /* size */
> >+                get_le16(pb);        /* size */
> >                  sizeX= get_le32(pb); /* size */
> >                  st->codec->width = get_le32(pb);
> >                  st->codec->height = get_le32(pb);
> >@@ -589,9 +589,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
> >                  tag1 = get_le32(pb);
> >                  url_fskip(pb, 20);
> >  //                av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
> >-                size= sizeX;
> >-                if (size>  40) {
> >-                    st->codec->extradata_size = size - 40;
> >+                if (sizeX>  40) {
> >+                    st->codec->extradata_size = sizeX - 40;
> >                      st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
> >                      get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
> >                  }
> 
> with "size" gone, maybe rename sizeX to size

This code is split out into a function that takes a 'size' parameter in
the next commit. This was actually the reason for this patch.

-- 
Anton Khirnov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110209/6982d922/attachment.pgp>



More information about the ffmpeg-devel mailing list