aports/community/rofi-file-browser-extended/gcc14.patch

68 lines
2.7 KiB
Diff

Source: https://github.com/marvinkreis/rofi-file-browser-extended/pull/49
--
From 4d402e599e209a072492cc8c0e35a5e039e7bfd6 Mon Sep 17 00:00:00 2001
From: Florian Schmaus <flo@geekplace.eu>
Date: Fri, 11 Nov 2022 15:13:22 +0100
Subject: [PATCH] Check that 'height' is within INT_MAX
---
src/filebrowser.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/filebrowser.c b/src/filebrowser.c
index 59f0140..3060cd2 100644
--- a/src/filebrowser.c
+++ b/src/filebrowser.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <gmodule.h>
#include <cairo.h>
+#include <limits.h>
#include <rofi/mode.h>
#include <rofi/helper.h>
#include <rofi/mode-private.h>
@@ -265,6 +266,13 @@ static char *file_browser_get_display_value ( const Mode *sw, unsigned int selec
static cairo_surface_t *file_browser_get_icon ( const Mode *sw, unsigned int selected_line, unsigned int height )
{
+ // We receive 'height' as unsinged int but later pass it to
+ // functions that take it as int, so check that the given value
+ // does not exceed INT_MAX.
+ if (height > INT_MAX) {
+ abort();
+ }
+
FileBrowserModePrivateData *pd = ( FileBrowserModePrivateData * ) mode_get_private_data ( sw );
FileBrowserFileData *fd = &pd->file_data;
FileBrowserIconData *id = &pd->icon_data;
---
From 6f62a2d0784a6937d35ac8f6df2e22c23bbfc8f4 Mon Sep 17 00:00:00 2001
From: Florian Schmaus <flo@geekplace.eu>
Date: Fri, 11 Nov 2022 15:03:32 +0100
Subject: [PATCH] Fix function pointer initialization
Fix
src/filebrowser.c:380:27: warning: incompatible function pointer types initializing '_mode_get_icon' (aka 'struct _cairo_surface *(*)(const struct rofi_mode *, unsigned int, unsigned int)') with an expression of type 'cairo_surface_t *(const Mode *, unsigned int, int)' (aka 'struct _cairo_surface *(const struct rofi_mode *, unsigned int, int)') [-Wincompatible-function-pointer-types]
._get_icon = file_browser_get_icon,
^~~~~~~~~~~~~~~~~~~~~
See also https://bugs.gentoo.org/880985
---
src/filebrowser.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/filebrowser.c b/src/filebrowser.c
index a5a19af..59f0140 100644
--- a/src/filebrowser.c
+++ b/src/filebrowser.c
@@ -263,7 +263,7 @@ static char *file_browser_get_display_value ( const Mode *sw, unsigned int selec
}
}
-static cairo_surface_t *file_browser_get_icon ( const Mode *sw, unsigned int selected_line, int height )
+static cairo_surface_t *file_browser_get_icon ( const Mode *sw, unsigned int selected_line, unsigned int height )
{
FileBrowserModePrivateData *pd = ( FileBrowserModePrivateData * ) mode_get_private_data ( sw );
FileBrowserFileData *fd = &pd->file_data;