[FFmpeg-cvslog] proresdec: Fix end condition
Michael Niedermayer
git at videolan.org
Wed May 22 20:25:44 CEST 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed May 22 19:44:12 2013 +0200| [30df9789a9745d8e4b1afc10d1a983bfc8816eb9] | committer: Michael Niedermayer
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 at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30df9789a9745d8e4b1afc10d1a983bfc8816eb9
---
libavcodec/proresdec2.c | 2 +-
libavcodec/proresdec_lgpl.c | 2 +-
tests/ref/fate/prores-transparency | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 374c5cb..5037bb8 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -458,7 +458,7 @@ static void unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs,
} else {
dst[idx++] = (alpha_val << 2) | (alpha_val >> 6);
}
- if (idx == num_coeffs - 1)
+ if (idx >= num_coeffs)
break;
} while (get_bits_left(gb)>0 && get_bits1(gb));
val = get_bits(gb, 4);
diff --git a/libavcodec/proresdec_lgpl.c b/libavcodec/proresdec_lgpl.c
index 73a1f6c..5e98d55 100644
--- a/libavcodec/proresdec_lgpl.c
+++ b/libavcodec/proresdec_lgpl.c
@@ -496,7 +496,7 @@ static void unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs,
dst[idx++] = alpha_val >> 6;
else
dst[idx++] = (alpha_val << 2) | (alpha_val >> 6);
- if (idx == num_coeffs - 1)
+ if (idx >= num_coeffs)
break;
} while (get_bits1(gb));
val = get_bits(gb, 4);
diff --git a/tests/ref/fate/prores-transparency b/tests/ref/fate/prores-transparency
index 3842970..9c71d33 100644
--- a/tests/ref/fate/prores-transparency
+++ b/tests/ref/fate/prores-transparency
@@ -1,5 +1,5 @@
#tb 0: 1/25
#tb 1: 1/48000
-0, 0, 0, 1, 16588800, 0x87f98f3c
+0, 0, 0, 1, 16588800, 0x20778f5e
1, 0, 0, 1024, 4096, 0x00000000
1, 1024, 1024, 896, 3584, 0x00000000
More information about the ffmpeg-cvslog
mailing list