summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-10-21 23:13:17 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-10-22 07:19:45 +0200
commitfcb2d8a87ad696f7f2fe069f0ed68a88803e1b54 (patch)
tree92bc8bdfb1887bfb3722ac47e0c0b86f1c0f0ba6 /external
parentad53c152cc1b79f9a64fffcff766e0fa29c3e287 (diff)
external/libxml2: Avoid UBSan nullptr-with-offset
...(new with Clang 10 trunk), where adding even an offset of 0 to a null pointer is UB in C. Seen when building UIConfig_modules/schart: > [UIL] chart2/uiconfig/ui/3dviewdialog > xpath.c:14532:5: runtime error: applying zero offset to null pointer > #0 in xmlXPathTryStreamCompile at workdir/UnpackedTarball/libxml2/xpath.c:14532:5 > #1 in xmlXPathCtxtCompile__internal_alias at workdir/UnpackedTarball/libxml2/xpath.c:14634:12 > #2 in xsltXPathCompileFlags at workdir/UnpackedTarball/libxslt/libxslt/xsltutils.c:2323:11 > #3 in xsltValueOfComp at workdir/UnpackedTarball/libxslt/libxslt/preproc.c:1258:18 > #4 in xsltStylePreCompute at workdir/UnpackedTarball/libxslt/libxslt/preproc.c:2225:6 > #5 in xsltParseTemplateContent at workdir/UnpackedTarball/libxslt/libxslt/xslt.c:4916:13 > #6 in xsltParseStylesheetTemplate at workdir/UnpackedTarball/libxslt/libxslt/xslt.c:5467:5 > #7 in xsltParseStylesheetTop at workdir/UnpackedTarball/libxslt/libxslt/xslt.c:6205:6 > #8 in xsltParseStylesheetProcess at workdir/UnpackedTarball/libxslt/libxslt/xslt.c:6461:2 > #9 in xsltParseStylesheetImportedDoc at workdir/UnpackedTarball/libxslt/libxslt/xslt.c:6675:9 > #10 in xsltParseStylesheetDoc at workdir/UnpackedTarball/libxslt/libxslt/xslt.c:6714:11 > #11 in main at workdir/UnpackedTarball/libxslt/xsltproc/xsltproc.c:888:9 Change-Id: I016ca8d24315385bcfeafca56dda44d9be10f517 Reviewed-on: https://gerrit.libreoffice.org/81285 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'external')
-rw-r--r--external/libxml2/UnpackedTarball_libxml2.mk1
-rw-r--r--external/libxml2/ubsan.patch.011
2 files changed, 12 insertions, 0 deletions
diff --git a/external/libxml2/UnpackedTarball_libxml2.mk b/external/libxml2/UnpackedTarball_libxml2.mk
index 00398f16af56..3194f1e08e75 100644
--- a/external/libxml2/UnpackedTarball_libxml2.mk
+++ b/external/libxml2/UnpackedTarball_libxml2.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,libxml2,\
external/libxml2/libxml2-vc10.patch \
$(if $(filter ANDROID,$(OS)),external/libxml2/libxml2-android.patch) \
external/libxml2/libxml2-icu.patch.0 \
+ external/libxml2/ubsan.patch.0 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/libxml2/ubsan.patch.0 b/external/libxml2/ubsan.patch.0
new file mode 100644
index 000000000000..234f66baddc2
--- /dev/null
+++ b/external/libxml2/ubsan.patch.0
@@ -0,0 +1,11 @@
+--- xpath.c
++++ xpath.c
+@@ -14529,7 +14529,7 @@
+ }
+
+ stream = xmlPatterncompile(str, dict, XML_PATTERN_XPATH,
+- &namespaces[0]);
++ namespaces == NULL ? NULL : &namespaces[0]);
+ if (namespaces != NULL) {
+ xmlFree((xmlChar **)namespaces);
+ }