Skip to content

failing to build crypto/cipher_extra/aead_test.cc with -Werror=stringop-overflow #3083

@omnivagant

Description

@omnivagant

to be more precise, the TestGCMSIV128Change16Alignment and TestGCMSIV256Change16Alignment tests

failing to build the tests on Alpinelinux edge with the following output

ninja: job failed: /usr/bin/c++ -DAWS_LC_TEST_ENV -DBORINGSSL_DISPATCH_TEST -DBORINGSSL_SHARED_LIBRARY -I/home/buildozer
/aports/community/aws-lc/src/aws-lc-1.68.0/build/symbol_prefix_include -I/home/buildozer/aports/community/aws-lc/src/aws
-lc-1.68.0/include -I/home/buildozer/aports/community/aws-lc/src/aws-lc-1.68.0/third_party/googletest/include -Os -fstac
k-clash-protection -Wformat -Werror=format-security -D_GLIBCXX_ASSERTIONS=1 -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1
 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -fno-plt  -Wall -fvisibility=hidden -fno-common -Wvla -Wtype-limit
s -Wno-unused-parameter -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -Wno-free-nonheap
-object -Wmissing-braces -Wimplicit-fallthrough -Wformat-signedness -Wmissing-declarations -fno-exceptions -fno-rtti -DH
AVE_LINUX_RANDOM_H -DAWS_LC_STDALIGN_AVAILABLE -DAWS_LC_BUILTIN_SWAP_SUPPORTED -std=gnu++11 -fPIE -Wno-deprecated-declar
ations -MD -MT crypto/CMakeFiles/crypto_test.dir/cipher_extra/aead_test.cc.o -MF crypto/CMakeFiles/crypto_test.dir/ciphe
r_extra/aead_test.cc.o.d -o crypto/CMakeFiles/crypto_test.dir/cipher_extra/aead_test.cc.o -c /home/buildozer/aports/comm
unity/aws-lc/src/aws-lc-1.68.0/crypto/cipher_extra/aead_test.cc
In file included from /home/buildozer/aports/community/aws-lc/src/aws-lc-1.68.0/crypto/cipher_extra/aead_test.cc:16:
In function 'void* memmove(void*, const void*, size_t)',
    inlined from 'virtual void AEADTest_TestGCMSIV128Change16Alignment_Test::TestBody()' at /home/buildozer/aports/commu
nity/aws-lc/src/aws-lc-1.68.0/crypto/cipher_extra/aead_test.cc:1316:10:
/usr/include/fortify/string.h:70:30: error: 'void* __orig_memmove(void*, const void*, size_t)' writing 584 bytes into a
region of size 568 overflows the destination [-Werror=stringop-overflow=]
   70 |         return __orig_memmove(__d, __s, __n);
      |                ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
In file included from /home/buildozer/aports/community/aws-lc/src/aws-lc-1.68.0/crypto/cipher_extra/aead_test.cc:22:
/home/buildozer/aports/community/aws-lc/src/aws-lc-1.68.0/include/openssl/aead.h: In member function 'virtual void AEADT
est_TestGCMSIV128Change16Alignment_Test::TestBody()':
/home/buildozer/aports/community/aws-lc/src/aws-lc-1.68.0/include/openssl/aead.h:223:31: note: destination object 'evp_a
ead_ctx_st::state' of size 568
  223 |   union evp_aead_ctx_st_state state;
      |                               ^~~~~
In file included from /usr/include/fortify/strings.h:23,
                 from /usr/include/string.h:59,
                 from /usr/include/fortify/string.h:23:
/usr/include/fortify/string.h:62:1: note: in a call to function 'void* __orig_memmove(void*, const void*, size_t)' decla
red with attribute 'access (read_only, 2, 3)'
   62 | _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d,
      | ^~~~~~~~~~~
In function 'void* memmove(void*, const void*, size_t)',
    inlined from 'virtual void AEADTest_TestGCMSIV256Change16Alignment_Test::TestBody()' at /home/buildozer/aports/commu
nity/aws-lc/src/aws-lc-1.68.0/crypto/cipher_extra/aead_test.cc:1357:10:
/usr/include/fortify/string.h:70:30: error: 'void* __orig_memmove(void*, const void*, size_t)' writing 584 bytes into a
region of size 568 overflows the destination [-Werror=stringop-overflow=]
   70 |         return __orig_memmove(__d, __s, __n);
      |                ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/home/buildozer/aports/community/aws-lc/src/aws-lc-1.68.0/include/openssl/aead.h: In member function 'virtual void AEADT
est_TestGCMSIV256Change16Alignment_Test::TestBody()':
/home/buildozer/aports/community/aws-lc/src/aws-lc-1.68.0/include/openssl/aead.h:223:31: note: destination object 'evp_a
ead_ctx_st::state' of size 568
  223 |   union evp_aead_ctx_st_state state;
      |                               ^~~~~
/usr/include/fortify/string.h:62:1: note: in a call to function 'void* __orig_memmove(void*, const void*, size_t)' decla
red with attribute 'access (read_only, 2, 3)'
   62 | _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d,
      | ^~~~~~~~~~~
cc1plus: all warnings being treated as errors
ninja: subcommand failed
>>> ERROR: aws-lc: build failed

I have not dug into if it's just an issue with these tests or an indicator of a deeper issue

we'll build with -Wno-error=stringop-overflow for now and it looks like nixpkgs are doing that as well https://github.com/NixOS/nixpkgs/blob/release-25.11/pkgs/by-name/aw/aws-lc/package.nix#L53

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions