diff options
author | Janne Grunau <janne-libav@jannau.net> | 2012-07-02 10:46:39 +0200 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2012-07-13 17:29:27 +0200 |
commit | 39bb27bf79bc4c2d8beaed637a14176264cb1916 (patch) | |
tree | d363bc12b73f4c31d6b72158f2328de99e759e05 /libavcodec | |
parent | 47aed43990e2bf31d0599d5ac862afa5e264a601 (diff) | |
download | ffmpeg-39bb27bf79bc4c2d8beaed637a14176264cb1916.tar.gz |
imgconvert: avoid undefined left shift in avcodec_find_best_pix_fmt
CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/imgconvert.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 90c9b7b255..7a6102e08b 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -599,7 +599,8 @@ static enum PixelFormat avcodec_find_best_pix_fmt1(int64_t pix_fmt_mask, /* find exact color match with smallest size */ dst_pix_fmt = PIX_FMT_NONE; min_dist = 0x7fffffff; - for(i = 0;i < PIX_FMT_NB; i++) { + /* test only the first 64 pixel formats to avoid undefined behaviour */ + for (i = 0; i < 64; i++) { if (pix_fmt_mask & (1ULL << i)) { loss = avcodec_get_pix_fmt_loss(i, src_pix_fmt, has_alpha) & loss_mask; if (loss == 0) { |