proresdec: Fix end condition

Fixes out of array writes
No FFmpeg release is affected by this

This also fixes some artifacts

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/18/merge
Michael Niedermayer 12 years ago
parent df3ee7b9a9
commit 30df9789a9
  1. 2
      libavcodec/proresdec2.c
  2. 2
      libavcodec/proresdec_lgpl.c
  3. 2
      tests/ref/fate/prores-transparency

@ -458,7 +458,7 @@ static void unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs,
} else { } else {
dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); dst[idx++] = (alpha_val << 2) | (alpha_val >> 6);
} }
if (idx == num_coeffs - 1) if (idx >= num_coeffs)
break; break;
} while (get_bits_left(gb)>0 && get_bits1(gb)); } while (get_bits_left(gb)>0 && get_bits1(gb));
val = get_bits(gb, 4); val = get_bits(gb, 4);

@ -496,7 +496,7 @@ static void unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs,
dst[idx++] = alpha_val >> 6; dst[idx++] = alpha_val >> 6;
else else
dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); dst[idx++] = (alpha_val << 2) | (alpha_val >> 6);
if (idx == num_coeffs - 1) if (idx >= num_coeffs)
break; break;
} while (get_bits1(gb)); } while (get_bits1(gb));
val = get_bits(gb, 4); val = get_bits(gb, 4);

@ -1,5 +1,5 @@
#tb 0: 1/25 #tb 0: 1/25
#tb 1: 1/48000 #tb 1: 1/48000
0, 0, 0, 1, 16588800, 0x87f98f3c 0, 0, 0, 1, 16588800, 0x20778f5e
1, 0, 0, 1024, 4096, 0x00000000 1, 0, 0, 1024, 4096, 0x00000000
1, 1024, 1024, 896, 3584, 0x00000000 1, 1024, 1024, 896, 3584, 0x00000000

Loading…
Cancel
Save