On 12.05.2015 14:51, Michael Niedermayer wrote:
> On Tue, May 12, 2015 at 02:31:38PM +0200, Andreas Cadhalpun wrote:
>> @@ -108,6 +109,14 @@ static int decode_packet(int *got_frame, int cached)
>> (const uint8_t **)(frame->data), frame->linesize,
>> pix_fmt, width, height);
>>
>> + if ((desc->flags & AV_PIX_FMT_FLAG_PAL ||
>> + desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) &&
>> + video_dst_data[1] - video_dst_data[0] >
>> video_dst_linesize[0] * height) {
>> + /* zero-initialize the padding before the palette */
>> + memset(video_dst_data[0] + video_dst_linesize[0] * height,
>> 0,
>> + video_dst_data[1] - video_dst_data[0] -
>> video_dst_linesize[0] * height);
>> + }
>
> i wonder if this shouldnt be moved to av_image_alloc() ?
It's a bit nicer to do this in av_image_fill_pointers.
New patch attached.
Best regards,
Andreas
>From 636d367e35363cb3388897aeded7d836d381cb11 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <[email protected]>
Date: Tue, 12 May 2015 15:51:21 +0200
Subject: [PATCH] imgutils: initialize palette padding bytes in
av_image_fill_pointers
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_fill_pointers.
This fixes 'Syscall param write(buf) points to uninitialised byte(s)'
valgrind warnings.
Signed-off-by: Andreas Cadhalpun <[email protected]>
---
libavutil/imgutils.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index a8bc18d..bef3390 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -125,7 +125,11 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei
if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
+ i = size[0];
size[0] = (size[0] + 3) & ~3;
+ /* zero-initialize the padding before the palette */
+ if (data[0] && size[0] - i > 0)
+ memset(data[0] + i, 0, size[0] - i);
data[1] = ptr + size[0]; /* palette is stored here as 256 32 bits words */
return size[0] + 256 * 4;
}
--
2.1.4
_______________________________________________
ffmpeg-devel mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel