[FFmpeg-cvslog] avfilter/video: don't zero allocated buffers if memory poisoning is used

James Almer git at videolan.org
Tue Aug 13 05:13:01 EEST 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat Aug 10 21:31:16 2024 -0300| [41307ff3e9384c51d646bff7e3dcf0d554098a8f] | committer: James Almer

avfilter/video: don't zero allocated buffers if memory poisoning is used

Same as in avcodec/get_buffer.c
Should help in debugging use of uninitialized memory.

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=41307ff3e9384c51d646bff7e3dcf0d554098a8f
---

 libavfilter/video.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavfilter/video.c b/libavfilter/video.c
index 89d0797ab5..afd3dc3dc3 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -71,8 +71,10 @@ AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int alig
     }
 
     if (!li->frame_pool) {
-        li->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h,
-                                                  link->format, align);
+        li->frame_pool = ff_frame_pool_video_init(CONFIG_MEMORY_POISONING
+                                                     ? NULL
+                                                     : av_buffer_allocz,
+                                                  w, h, link->format, align);
         if (!li->frame_pool)
             return NULL;
     } else {
@@ -86,8 +88,10 @@ AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int alig
             pool_format != link->format || pool_align != align) {
 
             ff_frame_pool_uninit(&li->frame_pool);
-            li->frame_pool = ff_frame_pool_video_init(av_buffer_allocz, w, h,
-                                                      link->format, align);
+            li->frame_pool = ff_frame_pool_video_init(CONFIG_MEMORY_POISONING
+                                                         ? NULL
+                                                         : av_buffer_allocz,
+                                                      w, h, link->format, align);
             if (!li->frame_pool)
                 return NULL;
         }



More information about the ffmpeg-cvslog mailing list