Skip to content

Conversation

bjosv
Copy link
Contributor

@bjosv bjosv commented Aug 8, 2025

Fixes runtime error warnings found when running tests in the aws-crt-cpp repo with the undefined behavior sanitizer enabled.

cd aws-crt-cpp
mkdir build && cd build
CC=clang-18 CXX=clang++-18 cmake -G Ninja -DENABLE_SANITIZERS=ON -DSANITIZERS="undefined" ..
ninja
ninja test
grep "runtime error" Testing/Temporary/LastTest.log
...
aws-crt-cpp/crt/aws-c-common/source/hash_table.c:68:12: runtime error: call to function aws_byte_cursor_eq through pointer to incorrect function type 'bool (*)(const void *, const void *)'
...

Description of changes:
Add callback functions that uses correct signature aws_hash_callback_eq_fn (as also seen in aws-c-mqtt).

Since the CI-build is not using -fno-sanitize-recover=all, and the warnings are recoverable, they will not fail the CI build.

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

Fixes runtime error warnings found when running the tests in the
"aws-crt-cpp" repo with the undefined behavior sanitizer enabled.

"runtime error: call to function aws_byte_cursor_eq through pointer
 to incorrect function type 'bool (*)(const void *, const void *)'"

Signed-off-by: Björn Svensson <[email protected]>
@bjosv
Copy link
Contributor Author

bjosv commented Sep 4, 2025

As a update;
these warnings can also be seen when running the tests in aws-c-http itself.
There are 651 warnings in the 709 tests.

INSTALL_PATH=/tmp/aws-install   %% installed dependencies
cd aws-c-http
mkdir build && cd build
CC=clang-18 CXX=clang++-18 cmake -G Ninja -DCMAKE_PREFIX_PATH=${INSTALL_PATH} -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITIZERS=ON -DSANITIZERS="undefined" ..
ninja
ninja test
grep "runtime error: call to function aws_byte_cursor_eq" Testing/Temporary/LastTest.log | wc -l

651

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.

1 participant