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

glb does not compile on Ubuntu 24.04 #38

Open
shinguz opened this issue May 1, 2024 · 3 comments
Open

glb does not compile on Ubuntu 24.04 #38

shinguz opened this issue May 1, 2024 · 3 comments
Assignees

Comments

@shinguz
Copy link

shinguz commented May 1, 2024

The same code and the same build script worked in Ubuntu 20.04 and 22.04 as well as on Debian 10 - 12. Compiling on Ubuntu 24.04 gave an error:

gcc --version
gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0

make
make all-recursive
make[1]: Entering directory '/home/build/buildpack/glb-1.0.1'
Making all in src
make[2]: Entering directory '/home/build/buildpack/glb-1.0.1/src'
gcc -DHAVE_CONFIG_H -I. -I.. -DNDEBUG -D_GNU_SOURCE -DUSE_EPOLL -Wdate-time -D_FORTIFY_SOURCE=3 -g -O3 -Wall -Werror -DGLBD -g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/build/buildpack/glb-1.0.1=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=/home/build/buildpack/glb-1.0.1=/usr/src/glb-1.0.1-3-noble -c -o glbd-glb_wdog.o test -f 'glb_wdog.c' || echo './'glb_wdog.c
glb_wdog.c: In function 'wdog_copy_result':
glb_wdog.c:335:21: error: pointer 'others_72' may be used after 'realloc' [-Werror=use-after-free]
335 | free (others);
| ^~~~~~~~~~~~~
glb_wdog.c:332:36: note: call to 'realloc' here
332 | d->result.others = realloc (others, res->others_len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:720: glbd-glb_wdog.o] Error 1
make[2]: Leaving directory '/home/build/buildpack/glb-1.0.1/src'
make[1]: *** [Makefile:413: all-recursive] Error 1
make[1]: Leaving directory '/home/build/buildpack/glb-1.0.1'
make: *** [Makefile:345: all] Error 2

329 if (others_len < res->others_len ||
330 others_len > (res->others_len * 2)) {
331 // buffer size is too different, reallocate
332 d->result.others = realloc (others, res->others_len);
333 if (!d->result.others && res->others_len > 0) {
334 // this is pretty much fatal, but we'll try
335 free (others);
336 d->result.others_len = 0;
337 }
338 else {
339 changed_length = true;
340 d->result.others_len = res->others_len;
341 }
342 }

Would be happy for a fix/hint. Thanks!

@ayurchen ayurchen self-assigned this May 2, 2024
ayurchen added a commit that referenced this issue May 2, 2024
Use stack variable for realloc() return value.
Fixes compilation with GCC 13.2.
@ayurchen
Copy link
Member

ayurchen commented May 2, 2024

Thanks Oli, that is fixed in the docker-build branch. Shall be merged ASAP.

ayurchen added a commit that referenced this issue May 2, 2024
Use stack variable for realloc() return value.
Fixes compilation with GCC 13.2.

Bump patch version to 1.0.2
@shinguz
Copy link
Author

shinguz commented May 3, 2024

You are very welcome. Do you mind to increase the tag to 1.0.2 as well? :-)

@ayurchen
Copy link
Member

Indeed! )

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

No branches or pull requests

2 participants