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

Some warnings at GCC-11.x linux compilation #623

Closed
ROBERT-MCDOWELL opened this issue Jul 7, 2021 · 2 comments
Closed

Some warnings at GCC-11.x linux compilation #623

ROBERT-MCDOWELL opened this issue Jul 7, 2021 · 2 comments

Comments

@ROBERT-MCDOWELL
Copy link

ROBERT-MCDOWELL commented Jul 7, 2021

src/objects.c: In function ‘use_client_socket’:
src/objects.c:1449:17: warning: ‘memcpy’ offset [0, 31] is out of the bounds [0, 0] [-Warray-bounds]
 1449 |                 memcpy(user->scram_ClientKey, scram_client_key, sizeof(user->scram_ClientKey));
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/objects.c:1450:17: warning: ‘memcpy’ offset [0, 31] is out of the bounds [0, 0] [-Warray-bounds]
 1450 |                 memcpy(user->scram_ServerKey, scram_server_key, sizeof(user->scram_ServerKey));
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

thanks

@petere
Copy link
Member

petere commented Jul 9, 2021

I see it too, but I don't think this warning message makes sense. It's essentially claiming that user->scram_ClientKey and user->scram_ServerKey have size 0. It's even weirder when you set -Warray-bounds=0, then you get

src/objects.c:1449:17: warning: '__builtin_memcpy' writing 32 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
src/objects.c:1450:17: warning: '__builtin_memcpy' writing 32 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]

which appears to be the same compiler confusion in a different form.

@ROBERT-MCDOWELL
Copy link
Author

I recalll that many apps had to update memcpy since gcc11 is more strict

@petere petere closed this as completed in b266456 Aug 6, 2021
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