Also disable check for unsigned integer overflow.
I couldn't find a way to reliably disable it for a single function:
https://github.com/google/sanitizers/issues/765
and warnings it produces do not seem to be of enough importance to
introduce ugly hacks like resetting the most significant byte here:
size_t result = 0;
// ...
for(; len; --len) {
result = (size_t)(result << 8);
// ^^^^
case "$SANITIZER" in
undefined)
- flags='-fsanitize=integer -fsanitize=nullability'
+ flags='-fsanitize=integer -fsanitize=nullability -fno-sanitize=unsigned-integer-overflow'
export UBSAN_OPTIONS="log_path=$logs/ubsan:print_stacktrace=1"
;;
address)
flags='-fsanitize-address-use-after-scope -fsanitize=pointer-compare -fsanitize=pointer-subtract'
export ASAN_OPTIONS="log_path=$logs/asan:detect_invalid_pointer_pairs=2:strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1"
+ export LSAN_OPTIONS="suppressions=$dir/suppress.txt:print_suppressions=0"
;;
thread)
--- /dev/null
+# known leak from one-time allocation
+# upstream refuses to fix such things: https://dev.gnupg.org/T4499
+leak:libgcrypt.so
+
- name: Run tests with OpenSSL 3
run: bash .ci/sanitizers/run.sh openssl3
+ if: always()
- name: Sanitize tests with default settings
run: bash .ci/sanitizers/run.sh default
run: bash .ci/sanitizers/run.sh nolegacy
if: always()
+ - name: Run tests with libgcrypt
+ run: bash .ci/sanitizers/run.sh gcrypt
+ if: always()
+
- name: Upload test results
uses: actions/upload-artifact@v2
with:
char b64[B64_SIZE(size)];
const size_t b64len = b64encode(b64, buf, size);
- for(char *p = b64; p < b64 + b64len; p += 64) {
- if(fprintf(fp, "%.64s\n", p) <= 0) {
+ for(size_t i = 0; i < b64len; i += 64) {
+ if(fprintf(fp, "%.64s\n", &b64[i]) <= 0) {
return false;
}
}
return 0;
}
- while(len--) {
+ for(; len; --len) {
result = (size_t)(result << 8);
result |= *(*p)++;
(*buflen)--;