1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-20 00:21:35 +00:00

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]
This commit is contained in:
Dima Panov 2022-05-05 13:18:05 +03:00
parent f86da7c9da
commit 345fdf99b1
3 changed files with 52 additions and 0 deletions

View File

@ -1,5 +1,6 @@
PORTNAME= uefi-edk2-bhyve
PORTVERSION= g20210226
PORTREVISION= 1
PORTEPOCH= 2
CATEGORIES= sysutils

View File

@ -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;

View File

@ -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,