[FFmpeg-devel] [PATCH] cmdutils: poison released video buffers.

Nicolas George nicolas.george at normalesup.org
Fri Aug 17 18:12:28 CEST 2012


Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 cmdutils.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)


It breaks the followinf FATE tests:

lavfi-overlay
filter-yadif-mode0
filter-yadif-mode1
h264-conformance-frext-hpcamolq_brcm_b
h264-conformance-frext-hpcvmolq_brcm_b
tscc-15bit
tscc-32bit
id-cin-video
mpeg2-field-enc

Unless I am completely mistaken about what get_buffer/release_buffer are
supposed to do, this is the sign of real bugs.


diff --git a/cmdutils.c b/cmdutils.c
index 6859692..6502f1c 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -1310,6 +1310,19 @@ void codec_release_buffer(AVCodecContext *s, AVFrame *frame)
     FrameBuffer *buf = frame->opaque;
     int i;
 
+#if CONFIG_MEMORY_POISONING
+    if (frame->width && frame->height && frame->format != PIX_FMT_NONE) {
+        int vsub = av_pix_fmt_descriptors[frame->format].log2_chroma_h;
+        for (i = 0; i < 4 && frame->data[i]; i++) {
+            int y, h = frame->height >> (i == 1 || i == 2 ? vsub : 0);
+            size_t size = av_image_get_linesize(frame->format, frame->width, i);
+            uint8_t *data = frame->data[i];
+            for (y = 0; y < h; y++, data += frame->linesize[i])
+                memset(data, 0x2a, size);
+        }
+    }
+#endif
+
     if(frame->type!=FF_BUFFER_TYPE_USER) {
         avcodec_default_release_buffer(s, frame);
         return;
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list