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

Avoid gcc-12 compile warnings. #495

Merged
merged 3 commits into from
May 20, 2022
Merged

Avoid gcc-12 compile warnings. #495

merged 3 commits into from
May 20, 2022

Conversation

bryce-shang
Copy link
Contributor

@bryce-shang bryce-shang commented May 19, 2022

Issues:

#487

Description of changes:

This PR fixed below warnings reported by gcc-12 on x86-64. Both warnings are false-positive.

Warning 1

In function 'memset',
    inlined from 'OPENSSL_memset' at /home/ubuntu/aws-lc/crypto/x509v3/../internal.h:845:10,
    inlined from 'ipv6_from_asc' at /home/ubuntu/aws-lc/crypto/x509v3/v3_utl.c:1285:9,
    inlined from 'x509v3_a2i_ipadd' at /home/ubuntu/aws-lc/crypto/x509v3/v3_utl.c:1194:14,
    inlined from 'X509_check_ip_asc' at /home/ubuntu/aws-lc/crypto/x509v3/v3_utl.c:1114:21:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:59:10: error: '__builtin_memset' forming offset 16 is out of the bounds [0, 16] of object 'ipout' with type 'unsigned char[16]' [-Werror=array-bounds]
   59 |   return __builtin___memset_chk (__dest, __ch, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   60 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/aws-lc/crypto/x509v3/v3_utl.c: In function 'X509_check_ip_asc':
/home/ubuntu/aws-lc/crypto/x509v3/v3_utl.c:1109:19: note: 'ipout' declared here
 1109 |     unsigned char ipout[16];
      |                   ^~~~~

Warning 2

ubuntu/aws-lc/crypto/fipsmodule/bcm.c
In function 'SHA224_Final':
cc1: error: writing 4 bytes into a region of size 0 [-Werror=stringop-overflow=]
In file included from /home/ubuntu/aws-lc/crypto/fipsmodule/bcm.c:131:
/home/ubuntu/aws-lc/crypto/fipsmodule/sha/sha256.c:194:26: note: at offset 28 into destination object 'out' of size [0, 28]
  194 | int SHA224_Final(uint8_t out[SHA224_DIGEST_LENGTH], SHA256_CTX *ctx) {
      |                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Call-outs:

  • The compile warnings were reported when building with DCMAKE_BUILD_TYPE=Release.
  • CryptoAlg-1100 is created to add gcc-12 into CI.
  • Below suppression does not work.
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wstringop-overflow"

Testing:

source tests/ci/common_posix_setup.sh

# echo "Testing AWS-LC in release mode."
build_and_test -DCMAKE_BUILD_TYPE=Release

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@DominicDams DominicDams self-requested a review May 19, 2022 22:51
@bryce-shang bryce-shang merged commit c859986 into aws:main May 20, 2022
@bryce-shang bryce-shang deleted the i487 branch May 20, 2022 00:31
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.

3 participants