[FFmpeg-devel] [PATCH] Remove unsafe bitwise OR on FFVulkanExtensions enum

Amir Mazzarella amirmazz at google.com
Sat Jul 9 06:57:23 EEST 2022


FFVulkanExtensions enum does not have a value for 0 defined, and bitwise OR on enums is not safe. The function returns uint64_t, so it makes more sense and is safer to do arithmetic in terms of uint64_t

Signed-off-by: Amir Mazzarella <amirmazz at google.com>
---
 libavutil/vulkan_loader.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/vulkan_loader.h b/libavutil/vulkan_loader.h
index 3f1ee6aa46..0b2de4ab94 100644
--- a/libavutil/vulkan_loader.h
+++ b/libavutil/vulkan_loader.h
@@ -50,12 +50,12 @@ static inline uint64_t ff_vk_extensions_to_mask(const char * const *extensions,
 #endif
     };
 
-    FFVulkanExtensions mask = 0x0;
+    uint64_t mask = 0x0;
 
     for (int i = 0; i < nb_extensions; i++) {
         for (int j = 0; j < FF_ARRAY_ELEMS(extension_map); j++) {
             if (!strcmp(extensions[i], extension_map[j].name)) {
-                mask |= extension_map[j].flag;
+                mask |= (uint64_t) extension_map[j].flag;
                 continue;
             }
         }
-- 
2.37.0.rc0.161.g10f37bed90-goog



More information about the ffmpeg-devel mailing list