[Libreoffice-commits] core.git: 2 commits - external/icu external/libxml2

Stephan Bergmann sbergman at redhat.com
Tue Jan 6 08:46:17 PST 2015


 external/icu/icu-ubsan.patch.0           |   11 ++++
 external/libxml2/UnpackedTarball_xml2.mk |    1 
 external/libxml2/ubsan.patch.0           |   84 +++++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+)

New commits:
commit d81dbb6dee272bd18c7a1d3e0dbe429b04187f8b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 6 17:45:00 2015 +0100

    external/libxml2: Work around -fsanitize=bounds
    
    Change-Id: I57d30410640fa1b7e1768136b1802546b2b7253f

diff --git a/external/libxml2/UnpackedTarball_xml2.mk b/external/libxml2/UnpackedTarball_xml2.mk
index 9c53b1f..beed009 100644
--- a/external/libxml2/UnpackedTarball_xml2.mk
+++ b/external/libxml2/UnpackedTarball_xml2.mk
@@ -18,6 +18,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,xml2,\
 	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 0000000..cebacc4
--- /dev/null
+++ b/external/libxml2/ubsan.patch.0
@@ -0,0 +1,84 @@
+--- parser.c
++++ parser.c
+@@ -1052,7 +1052,7 @@
+ struct _xmlDefAttrs {
+     int nbAttrs;	/* number of defaulted attributes on that element */
+     int maxAttrs;       /* the size of the array */
+-    const xmlChar *values[5]; /* array of localname/prefix/values/external */
++    const xmlChar *values[1][5]; /* array of localname/prefix/values/external */
+ };
+ 
+ /**
+@@ -1244,17 +1244,17 @@
+ 	prefix = xmlDictLookup(ctxt->dict, fullattr, len);
+     }
+ 
+-    defaults->values[5 * defaults->nbAttrs] = name;
+-    defaults->values[5 * defaults->nbAttrs + 1] = prefix;
++    defaults->values[defaults->nbAttrs][0] = name;
++    defaults->values[defaults->nbAttrs][1] = prefix;
+     /* intern the string and precompute the end */
+     len = xmlStrlen(value);
+     value = xmlDictLookup(ctxt->dict, value, len);
+-    defaults->values[5 * defaults->nbAttrs + 2] = value;
+-    defaults->values[5 * defaults->nbAttrs + 3] = value + len;
++    defaults->values[defaults->nbAttrs][2] = value;
++    defaults->values[defaults->nbAttrs][3] = value + len;
+     if (ctxt->external)
+-        defaults->values[5 * defaults->nbAttrs + 4] = BAD_CAST "external";
++        defaults->values[defaults->nbAttrs][4] = BAD_CAST "external";
+     else
+-        defaults->values[5 * defaults->nbAttrs + 4] = NULL;
++        defaults->values[defaults->nbAttrs][4] = NULL;
+     defaults->nbAttrs++;
+ 
+     return;
+@@ -9474,8 +9474,8 @@
+ 	defaults = xmlHashLookup2(ctxt->attsDefault, localname, prefix);
+ 	if (defaults != NULL) {
+ 	    for (i = 0;i < defaults->nbAttrs;i++) {
+-	        attname = defaults->values[5 * i];
+-		aprefix = defaults->values[5 * i + 1];
++	        attname = defaults->values[i][0];
++		aprefix = defaults->values[i][1];
+ 
+                 /*
+ 		 * special work for namespaces defaulted defs
+@@ -9490,9 +9490,9 @@
+ 	            if (j <= nbNs) continue;
+ 
+ 		    nsname = xmlGetNamespace(ctxt, NULL);
+-		    if (nsname != defaults->values[5 * i + 2]) {
++		    if (nsname != defaults->values[i][2]) {
+ 			if (nsPush(ctxt, NULL,
+-			           defaults->values[5 * i + 2]) > 0)
++			           defaults->values[i][2]) > 0)
+ 			    nbNs++;
+ 		    }
+ 		} else if (aprefix == ctxt->str_xmlns) {
+@@ -9505,9 +9505,9 @@
+ 	            if (j <= nbNs) continue;
+ 
+ 		    nsname = xmlGetNamespace(ctxt, attname);
+-		    if (nsname != defaults->values[2]) {
++		    if (nsname != defaults->values[0][2]) {
+ 			if (nsPush(ctxt, attname,
+-			           defaults->values[5 * i + 2]) > 0)
++			           defaults->values[i][2]) > 0)
+ 			    nbNs++;
+ 		    }
+ 		} else {
+@@ -9533,10 +9533,10 @@
+ 			atts[nbatts++] = NULL;
+ 		    else
+ 		        atts[nbatts++] = xmlGetNamespace(ctxt, aprefix);
+-		    atts[nbatts++] = defaults->values[5 * i + 2];
+-		    atts[nbatts++] = defaults->values[5 * i + 3];
++		    atts[nbatts++] = defaults->values[i][2];
++		    atts[nbatts++] = defaults->values[i][3];
+ 		    if ((ctxt->standalone == 1) &&
+-		        (defaults->values[5 * i + 4] != NULL)) {
++		        (defaults->values[i][4] != NULL)) {
+ 			xmlValidityError(ctxt, XML_DTD_STANDALONE_DEFAULTED,
+ 	  "standalone: attribute %s on %s defaulted from external subset\n",
+ 	                                 attname, localname);
commit 901091f47a661571a7fb935bd5ccec34e37ad688
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 6 17:44:19 2015 +0100

    external/icu: Work around -fsanitize=signed-integer-overflow
    
    Change-Id: Iec76486aa8a0eef7e1a5c74b416d466f16ff979a

diff --git a/external/icu/icu-ubsan.patch.0 b/external/icu/icu-ubsan.patch.0
index c6baaed..c1d229c 100644
--- a/external/icu/icu-ubsan.patch.0
+++ b/external/icu/icu-ubsan.patch.0
@@ -127,6 +127,17 @@
                    length(len), next(subNode) {}
          virtual UBool operator==(const Node &other) const;
          virtual int32_t markRightEdgesFirst(int32_t edgeNumber);
+--- source/common/unifiedcache.h
++++ source/common/unifiedcache.h
+@@ -139,7 +139,7 @@
+            : CacheKey<T>(other), fLoc(other.fLoc) { }
+    virtual ~LocaleCacheKey() { }
+    virtual int32_t hashCode() const {
+-       return 37 *CacheKey<T>::hashCode() + fLoc.hashCode();
++       return 37U *CacheKey<T>::hashCode() + fLoc.hashCode();
+    }
+    virtual UBool operator == (const CacheKeyBase &other) const {
+        // reflexive
 --- source/common/uresbund.cpp
 +++ source/common/uresbund.cpp
 @@ -53,7 +53,7 @@


More information about the Libreoffice-commits mailing list