* [FFmpeg-devel] [PATCH] Remove unsafe bitwise OR on FFVulkanExtensions enum
@ 2022-07-09 3:57 Amir Mazzarella
2022-07-19 18:31 ` Amir Mazzarella
0 siblings, 1 reply; 3+ messages in thread
From: Amir Mazzarella @ 2022-07-09 3:57 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Amir Mazzarella
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@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
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] Remove unsafe bitwise OR on FFVulkanExtensions enum
2022-07-09 3:57 [FFmpeg-devel] [PATCH] Remove unsafe bitwise OR on FFVulkanExtensions enum Amir Mazzarella
@ 2022-07-19 18:31 ` Amir Mazzarella
2022-07-20 4:34 ` Marvin Scholz
0 siblings, 1 reply; 3+ messages in thread
From: Amir Mazzarella @ 2022-07-19 18:31 UTC (permalink / raw)
To: ffmpeg-devel
Ping
On Fri, Jul 8, 2022 at 8:57 PM Amir Mazzarella <amirmazz@google.com> wrote:
> 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@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
>
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] Remove unsafe bitwise OR on FFVulkanExtensions enum
2022-07-19 18:31 ` Amir Mazzarella
@ 2022-07-20 4:34 ` Marvin Scholz
0 siblings, 0 replies; 3+ messages in thread
From: Marvin Scholz @ 2022-07-20 4:34 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On 19 Jul 2022, at 20:31, Amir Mazzarella wrote:
> Ping
>
> On Fri, Jul 8, 2022 at 8:57 PM Amir Mazzarella <amirmazz@google.com> wrote:
>
>> 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
I am curious, can you elaborate why it would not be safe to do the bitwise
OR on an enum?
>>
>> Signed-off-by: Amir Mazzarella <amirmazz@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
>>
>>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-20 4:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-09 3:57 [FFmpeg-devel] [PATCH] Remove unsafe bitwise OR on FFVulkanExtensions enum Amir Mazzarella
2022-07-19 18:31 ` Amir Mazzarella
2022-07-20 4:34 ` Marvin Scholz
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git