aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDima Panov <fluffy@FreeBSD.org>2022-05-05 10:18:05 +0000
committerDima Panov <fluffy@FreeBSD.org>2022-05-05 10:25:47 +0000
commit345fdf99b13a6ddecf78058ab92ea89fa12b0d21 (patch)
tree4c9fcbcbba12c92f024ed5dab67d390999874931
parentf86da7c9da39f8b91c5d76005231ee873ebe92c4 (diff)
downloadports-345fdf99b13a6ddecf78058ab92ea89fa12b0d21.tar.gz
ports-345fdf99b13a6ddecf78058ab92ea89fa12b0d21.zip
sysutils/uefi-edk2-bhyve: fix build with modern compilers
Since GCC11/Clang13, build was failed with error: argument 2 of type 'const uint8_t *' {aka 'const unsigned char *'} declared as a pointer [-Werror=vla-parameter] Backport patch from brotli upstream While here, fix string pointer overflows in USB handler code [1] PR: 263545 Approved by: portmgr blanket (Tier 1 fix build) Obtained from: Gentoo bug#801925 [1]
-rw-r--r--sysutils/uefi-edk2-bhyve/Makefile1
-rw-r--r--sysutils/uefi-edk2-bhyve/files/patch-fix-warnings29
-rw-r--r--sysutils/uefi-edk2-bhyve/files/patch-stringpop-overflows22
3 files changed, 52 insertions, 0 deletions
diff --git a/sysutils/uefi-edk2-bhyve/Makefile b/sysutils/uefi-edk2-bhyve/Makefile
index a13311675305..9769fc41316b 100644
--- a/sysutils/uefi-edk2-bhyve/Makefile
+++ b/sysutils/uefi-edk2-bhyve/Makefile
@@ -1,5 +1,6 @@
PORTNAME= uefi-edk2-bhyve
PORTVERSION= g20210226
+PORTREVISION= 1
PORTEPOCH= 2
CATEGORIES= sysutils
diff --git a/sysutils/uefi-edk2-bhyve/files/patch-fix-warnings b/sysutils/uefi-edk2-bhyve/files/patch-fix-warnings
new file mode 100644
index 000000000000..10e373e824a6
--- /dev/null
+++ b/sysutils/uefi-edk2-bhyve/files/patch-fix-warnings
@@ -0,0 +1,29 @@
+--- BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c
++++ BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c
+@@ -2033,8 +2033,10 @@ static BROTLI_NOINLINE BrotliDecoderErrorCode SafeProcessCommands(
+ }
+
+ BrotliDecoderResult BrotliDecoderDecompress(
+- size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size,
+- uint8_t* decoded_buffer) {
++ size_t encoded_size,
++ const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)],
++ size_t* decoded_size,
++ uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]) {
+ BrotliDecoderState s;
+ BrotliDecoderResult result;
+ size_t total_out = 0;
+--- BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c
++++ BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c
+@@ -1470,8 +1470,9 @@ static size_t MakeUncompressedStream(
+
+ BROTLI_BOOL BrotliEncoderCompress(
+ int quality, int lgwin, BrotliEncoderMode mode, size_t input_size,
+- const uint8_t* input_buffer, size_t* encoded_size,
+- uint8_t* encoded_buffer) {
++ const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)],
++ size_t* encoded_size,
++ uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]) {
+ BrotliEncoderState* s;
+ size_t out_size = *encoded_size;
+ const uint8_t* input_start = input_buffer;
diff --git a/sysutils/uefi-edk2-bhyve/files/patch-stringpop-overflows b/sysutils/uefi-edk2-bhyve/files/patch-stringpop-overflows
new file mode 100644
index 000000000000..9f7a4986a53f
--- /dev/null
+++ b/sysutils/uefi-edk2-bhyve/files/patch-stringpop-overflows
@@ -0,0 +1,22 @@
+--- MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c
++++ MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c
+@@ -285,7 +285,7 @@ UsbHcBulkTransfer (
+ IN UINT8 DevSpeed,
+ IN UINTN MaxPacket,
+ IN UINT8 BufferNum,
+- IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
++ IN OUT VOID **Data,
+ IN OUT UINTN *DataLength,
+ IN OUT UINT8 *DataToggle,
+ IN UINTN TimeOut,
+--- MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.h
++++ MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.h
+@@ -149,7 +149,7 @@ UsbHcBulkTransfer (
+ IN UINT8 DevSpeed,
+ IN UINTN MaxPacket,
+ IN UINT8 BufferNum,
+- IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
++ IN OUT VOID **Data,
+ IN OUT UINTN *DataLength,
+ IN OUT UINT8 *DataToggle,
+ IN UINTN TimeOut,