Commit 7296a6b5 authored by Janne Grunau's avatar Janne Grunau Committed by Anton Khirnov

imgconvert: avoid undefined left shift in avcodec_find_best_pix_fmt

CC: libav-stable@libav.org
(cherry picked from commit 39bb27bf)
Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
(cherry picked from commit 7a7229b5)
Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
(cherry picked from commit 8812b5f1)
Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
(cherry picked from commit fd7426ed)
Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent f695be22
......@@ -890,7 +890,8 @@ static int avcodec_find_best_pix_fmt1(int64_t pix_fmt_mask,
/* find exact color match with smallest size */
dst_pix_fmt = -1;
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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment