[FFmpeg-devel] [PATCH] ico: favour BITMAPHEADER dimensions over IconEntry dimensions

Peter Ross pross at xvid.org
Fri Jan 13 09:59:29 CET 2012


Fixes ticket 759.
---
 libavformat/icodec.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/icodec.c b/libavformat/icodec.c
index d53c33a..eab0478 100644
--- a/libavformat/icodec.c
+++ b/libavformat/icodec.c
@@ -64,6 +64,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
 
     for (i = 0; i < ico->nb_images; i++) {
         AVStream *st;
+        int tmp;
 
         if (avio_seek(pb, 6 + i * 16, SEEK_SET) < 0)
             break;
@@ -97,10 +98,12 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
             if (ico->images[i].size < 40)
                 return AVERROR_INVALIDDATA;
             st->codec->codec_id = CODEC_ID_BMP;
-            if (!st->codec->width || !st->codec->height) {
-                st->codec->width  = avio_rl32(pb);
-                st->codec->height = avio_rl32(pb) / 2;
-            }
+            tmp = avio_rl32(pb);
+            if (tmp)
+                st->codec->width = tmp;
+            tmp = avio_rl32(pb);
+            if (tmp)
+                st->codec->height = tmp / 2;
             break;
         default:
             av_log_ask_for_sample(s, "unsupported codec\n");
-- 
1.7.5.4

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120113/ffcfdfe9/attachment.asc>


More information about the ffmpeg-devel mailing list