summaryrefslogtreecommitdiff
path: root/external/libxml2/ubsan.patch.0
blob: cebacc470cc43ea346cb63459246d20775676df9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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);