[libxslt] Run CI tests with -fsanitize=integer



commit 85071e50e60ec7c5cb42716f6e0530b9d9e3976c
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Wed Aug 31 17:25:55 2022 +0200

    Run CI tests with -fsanitize=integer
    
    Specifically, enable unsigned-integer-overflow and implicit-conversion
    checks.
    
    Also remove -Wimplicit-int-conversion from CI test. Forcing explicit
    casts renders the implicit-conversion checks useless. Since UBSan is
    much more powerful and can detect actual bugs, it's a better idea to
    remove explicit integer casts except in cases where values are really
    truncated.
    
    Revert "Fix clang -Wimplicit-int-conversion warning"
    
    This reverts commit aac4bccdd893713dd058305e385d7f13f94e6add.
    
    Revert "Fix implicit-int-conversion warning in exslt/crypto.c"
    
    This reverts commit f235404b13f17d5343b854fe5d459a0c98bbd2d2.

 .gitlab-ci.yml    | 2 +-
 libexslt/crypto.c | 2 +-
 libxslt/numbers.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9c48602b..fe61164c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -42,7 +42,7 @@ clang:asan:
   variables:
     CONFIG: "--without-python"
     CC: clang
-    CFLAGS: "-O2 -g -fno-omit-frame-pointer -fsanitize=address,undefined -fno-sanitize-recover=all 
-Wimplicit-int-conversion -Wno-error=cast-align"
+    CFLAGS: "-O2 -g -fno-omit-frame-pointer 
-fsanitize=address,undefined,unsigned-integer-overflow,implicit-conversion -fno-sanitize-recover=all 
-Wno-error=cast-align"
     # LeakSanitizer requires SYS_CAP_PTRACE
     ASAN_OPTIONS: "detect_leaks=0"
     UBSAN_OPTIONS: "print_stacktrace=1"
diff --git a/libexslt/crypto.c b/libexslt/crypto.c
index 8845a132..da57b85a 100644
--- a/libexslt/crypto.c
+++ b/libexslt/crypto.c
@@ -94,7 +94,7 @@ exsltCryptoHex2Bin (const unsigned char *hex, int hexlen,
        else if (tmp >= 'a' && tmp <= 'f')
            lo = 10 + (tmp - 'a');
 
-       result = (unsigned char) (hi << 4);
+       result = hi << 4;
        result += lo;
        bin[j++] = result;
     }
diff --git a/libxslt/numbers.c b/libxslt/numbers.c
index 9c74f0d4..9e496bb2 100644
--- a/libxslt/numbers.c
+++ b/libxslt/numbers.c
@@ -183,7 +183,7 @@ xsltNumberFormatDecimal(xmlBufferPtr buffer,
                i = -1;
                break;
            }
-           *(--pointer) = (xmlChar)val;
+           *(--pointer) = val;
        }
        else {
        /*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]