[FFmpeg-cvslog] ico: favour BITMAPHEADER dimensions over IconEntry dimensions
Peter Ross
git at videolan.org
Fri Jan 13 16:09:00 CET 2012
ffmpeg | branch: master | Peter Ross <pross at xvid.org> | Fri Jan 13 19:59:29 2012 +1100| [3a1df393b8a1ee9304a34fbc4134a2a27e2b1f12] | committer: Michael Niedermayer
ico: favour BITMAPHEADER dimensions over IconEntry dimensions
Fixes ticket 759.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3a1df393b8a1ee9304a34fbc4134a2a27e2b1f12
---
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");
More information about the ffmpeg-cvslog
mailing list