aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/icodec.c
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2012-01-13 19:59:29 +1100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-13 15:57:34 +0100
commit3a1df393b8a1ee9304a34fbc4134a2a27e2b1f12 (patch)
treedfecaedc19f6d4e43e07190612157cd5ea47345e /libavformat/icodec.c
parentc949d5b15d2af23dcbbe2cb35b819d4930625d15 (diff)
downloadffmpeg-3a1df393b8a1ee9304a34fbc4134a2a27e2b1f12.tar.gz
ico: favour BITMAPHEADER dimensions over IconEntry dimensions
Fixes ticket 759. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/icodec.c')
-rw-r--r--libavformat/icodec.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libavformat/icodec.c b/libavformat/icodec.c
index d53c33ab0a..eab0478211 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");