[FFmpeg-cvslog] imgutils: initialize palette padding bytes in av_image_alloc
Andreas Cadhalpun
git at videolan.org
Thu May 14 20:58:43 CEST 2015
ffmpeg | branch: release/2.6 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Tue May 12 21:45:42 2015 +0200| [9bcaf9037813be8ffb42acc2e003cac1419c01b8] | committer: Andreas Cadhalpun
imgutils: initialize palette padding bytes in av_image_alloc
av_image_fill_pointers always aligns the palette, but the padding
bytes don't (and can't) get initialized in av_image_copy.
Thus initialize them in av_image_alloc.
This fixes 'Syscall param write(buf) points to uninitialised byte(s)'
valgrind warnings.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 51f64552853e16d72644308db53abee870aecfb9)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9bcaf9037813be8ffb42acc2e003cac1419c01b8
---
libavutil/imgutils.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index a8bc18d..ef0e671 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -219,6 +219,14 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);
+ if ((desc->flags & AV_PIX_FMT_FLAG_PAL ||
+ desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) &&
+ pointers[1] - pointers[0] > linesizes[0] * h) {
+ /* zero-initialize the padding before the palette */
+ memset(pointers[0] + linesizes[0] * h, 0,
+ pointers[1] - pointers[0] - linesizes[0] * h);
+ }
+
return ret;
}
More information about the ffmpeg-cvslog
mailing list