summaryrefslogtreecommitdiff
path: root/libavutil/imgutils.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-05-12 21:45:42 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-13 03:58:08 +0200
commit51f64552853e16d72644308db53abee870aecfb9 (patch)
treea66cc206b266cced3b3c09f00fd98b89758155bc /libavutil/imgutils.c
parenta7c0c79333fe30263b4729901a2a41ef8d2891f6 (diff)
downloadffmpeg-51f64552853e16d72644308db53abee870aecfb9.tar.gz
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@googlemail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/imgutils.c')
-rw-r--r--libavutil/imgutils.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index a8bc18d025..ef0e67154b 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;
}