[libxml2] Enable more undefined behavior sanitizers
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Enable more undefined behavior sanitizers
- Date: Sat, 2 Nov 2019 17:04:02 +0000 (UTC)
commit db0c0450db66606f4068b237ba233e97e0b16a69
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Sat Nov 2 15:14:10 2019 +0100
Enable more undefined behavior sanitizers
Minor fix to xmlStringLenGetNodeList to avoid a pointer overflow
during API test.
Enable pointer-overflow and unsigned-integer-overflow sanitizers in CI
tests. Technically, unsigned integer overflows aren't undefined
behavior, but they typically indicate programming errors. Some hash
functions that really require unsigned integer overflows have already
been annotated.
.gitlab-ci.yml | 2 +-
.travis.yml | 2 +-
tree.c | 4 +++-
3 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 78784fba..71f66e0b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -32,7 +32,7 @@ clang:asan:
variables:
CONFIG: "--without-python"
CC: clang
- CFLAGS: "-O2 -g -fno-omit-frame-pointer -fsanitize=address,undefined -fno-sanitize=pointer-overflow
-fno-sanitize-recover=all -Wno-error=cast-align"
+ CFLAGS: "-O2 -g -fno-omit-frame-pointer -fsanitize=address,undefined,unsigned-integer-overflow
-fno-sanitize-recover=all -Wno-error=cast-align"
UBSAN_OPTIONS: "print_stacktrace=1"
clang:msan:
diff --git a/.travis.yml b/.travis.yml
index 68fe5abd..358e8cbf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,7 +16,7 @@ matrix:
sudo: required
dist: trusty
env: CONFIG="--without-python"
- CFLAGS="-O2 -g -fno-omit-frame-pointer -fsanitize=address,undefined
-fno-sanitize=float-divide-by-zero,pointer-overflow -fno-sanitize-recover=all -Werror -Wno-error=cast-align"
+ CFLAGS="-O2 -g -fno-omit-frame-pointer -fsanitize=address,undefined,unsigned-integer-overflow
-fno-sanitize-recover=all -Werror -Wno-error=cast-align"
UBSAN_OPTIONS=print_stacktrace=1
script: sh autogen.sh $CONFIG && make -j2 V=1 && make check
git:
diff --git a/tree.c b/tree.c
index 08b1a500..070670f1 100644
--- a/tree.c
+++ b/tree.c
@@ -1276,12 +1276,14 @@ xmlStringLenGetNodeList(const xmlDoc *doc, const xmlChar *value, int len) {
xmlNodePtr ret = NULL, last = NULL;
xmlNodePtr node;
xmlChar *val;
- const xmlChar *cur = value, *end = cur + len;
+ const xmlChar *cur, *end;
const xmlChar *q;
xmlEntityPtr ent;
xmlBufPtr buf;
if (value == NULL) return(NULL);
+ cur = value;
+ end = cur + len;
buf = xmlBufCreateSize(0);
if (buf == NULL) return(NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]