Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vclog: fix max realloc compiler error #88

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

heitbaum
Copy link
Contributor

./vclog/vclog.c:211:34: error: argument 2 value '4294967288' exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]
211 | payload_buffer = realloc(payload_buffer, payload_buffer_size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./vclog/vclog.c:17:
../../toolchain/armv7ve-libreelec-linux-gnueabihf/sysroot/usr/include/stdlib.h:683:14: note: in a call to allocation function 'realloc' declared here
683 | extern void *realloc (void *__ptr, size_t __size)
| ^~~~~~~

Fixes

./vclog/vclog.c:211:34: error: argument 2 value '4294967288' exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]
  211 |                 payload_buffer = realloc(payload_buffer, payload_buffer_size);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./vclog/vclog.c:17:
../../toolchain/armv7ve-libreelec-linux-gnueabihf/sysroot/usr/include/stdlib.h:683:14: note: in a call to allocation function 'realloc' declared here
  683 | extern void *realloc (void *__ptr, size_t __size)
      |              ^~~~~~~
@pelwell
Copy link
Collaborator

pelwell commented May 23, 2024

Does this follow-up patch (which should be in heitbaum:patch-2 now) also work? It looks more correct to me.

@heitbaum
Copy link
Contributor Author

Does this follow-up patch (which should be in heitbaum:patch-2 now) also work? It looks more correct to me.

I didn’t like my version of 88 either (which is why I separated it from 87) but the size_t doesn’t work either. It matches 4GB too.

FAILED: vclog/CMakeFiles/vclog.dir/vclog.c.o 
/var/media/DATA/home-rudi/LibreELEC.kernel11/build.LibreELEC-RPi2.arm-12.0-devel/toolchain/bin/armv7ve-libreelec-linux-gnueabihf-gcc   -march=armv7ve -mtune=cortex-a7 -mabi=aapcs-linux -Wno-psabi -Wa,-mno-warn-deprecated -mfloat-abi=hard -mfpu=neon-vfpv4 -Wall -pipe  -O2 -fomit-frame-pointer -DNDEBUG -Wall -Wextra -Werror -pedantic -DDUMMYOPT -MD -MT vclog/CMakeFiles/vclog.dir/vclog.c.o -MF vclog/CMakeFiles/vclog.dir/vclog.c.o.d -o vclog/CMakeFiles/vclog.dir/vclog.c.o -c /var/media/DATA/home-rudi/LibreELEC.kernel11/build.LibreELEC-RPi2.arm-12.0-devel/build/bcm2835-utils-6dc6f5f3d129a6c9423316ac1a53efb19a5c40d1/vclog/vclog.c
/var/media/DATA/home-rudi/LibreELEC.kernel11/build.LibreELEC-RPi2.arm-12.0-devel/build/bcm2835-utils-6dc6f5f3d129a6c9423316ac1a53efb19a5c40d1/vclog/vclog.c: In function 'main':
/var/media/DATA/home-rudi/LibreELEC.kernel11/build.LibreELEC-RPi2.arm-12.0-devel/build/bcm2835-utils-6dc6f5f3d129a6c9423316ac1a53efb19a5c40d1/vclog/vclog.c:211:34: error: argument 2 value '4294967288' exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]
  211 |                 payload_buffer = realloc(payload_buffer, payload_buffer_size);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /var/media/DATA/home-rudi/LibreELEC.kernel11/build.LibreELEC-RPi2.arm-12.0-devel/build/bcm2835-utils-6dc6f5f3d129a6c9423316ac1a53efb19a5c40d1/vclog/vclog.c:17:
/var/media/DATA/home-rudi/LibreELEC.kernel11/build.LibreELEC-RPi2.arm-12.0-devel/toolchain/armv7ve-libreelec-linux-gnueabihf/sysroot/usr/include/stdlib.h:683:14: note: in a call to allocation function 'realloc' declared here
  683 | extern void *realloc (void *__ptr, size_t __size)
      |              ^~~~~~~
cc1: all warnings being treated as errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compile error with gcc-14.1 and 32-bit / 64-bit targets
2 participants