[FFmpeg-devel] [PATCH 5/5] avutil/vulkan: avoid overreads in ff_vk_count_images

Zhao Zhili quinkblack at foxmail.com
Tue Feb 20 14:08:58 EET 2024


From: Zhao Zhili <zhilizhao at tencent.com>

---
 libavutil/vulkan.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h
index b666841836..a5e78760d7 100644
--- a/libavutil/vulkan.h
+++ b/libavutil/vulkan.h
@@ -271,7 +271,7 @@ typedef struct FFVulkanContext {
 static inline int ff_vk_count_images(AVVkFrame *f)
 {
     int cnt = 0;
-    while (f->img[cnt])
+    while (cnt < FF_ARRAY_ELEMS(f->img) && f->img[cnt])
         cnt++;
 
     return cnt;
-- 
2.34.1



More information about the ffmpeg-devel mailing list