The constant array xmlUnicodeBlocks is not marked as 'const' so it ends up
in the read/write data segment instead of the read-only data segment, which
can lead to it becoming per-process private data instead of image-backed
shared data.

A patch file (made in the context of Chrome, but it should be applicable to
libxml2) is attached.

-- 
Bruce Dawson
commit eafa8bbee03e8ebba366be1fb8d5b1596a989a0a
Author: Bruce Dawson <brucedaw...@chromium.org>
Date:   Thu Jan 5 11:25:58 2017 -0800

    Add const in five places to move 1 KiB to .rdata
    
    xmlUnicodeBlocks is logically const but was not marked as such. This
    fixes that, thus moving it to the read-only data segment.
    
    BUG=677351

diff --git a/third_party/libxml/src/genUnicode.py 
b/third_party/libxml/src/genUnicode.py
index 56e4e9b..4487eeb 100755
--- a/third_party/libxml/src/genUnicode.py
+++ b/third_party/libxml/src/genUnicode.py
@@ -267,14 +267,14 @@ typedef struct {
 } xmlUnicodeRange;
 
 typedef struct {
-    xmlUnicodeRange *table;
+    const xmlUnicodeRange *table;
     int                    numentries;
 } xmlUnicodeNameTable;
 
 
 static xmlIntFunc *xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char 
*tname);
 
-static xmlUnicodeRange xmlUnicodeBlocks[] = {
+static const xmlUnicodeRange xmlUnicodeBlocks[] = {
 """ % (webpage, date, sources));
 
 flag = 0
diff --git a/third_party/libxml/src/xmlunicode.c 
b/third_party/libxml/src/xmlunicode.c
index ce6e9a4..6d0a96a 100644
--- a/third_party/libxml/src/xmlunicode.c
+++ b/third_party/libxml/src/xmlunicode.c
@@ -29,14 +29,14 @@ typedef struct {
 } xmlUnicodeRange;
 
 typedef struct {
-    xmlUnicodeRange *table;
+    const xmlUnicodeRange *table;
     int                    numentries;
 } xmlUnicodeNameTable;
 
 
 static xmlIntFunc *xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char 
*tname);
 
-static xmlUnicodeRange xmlUnicodeBlocks[] = {
+static const xmlUnicodeRange xmlUnicodeBlocks[] = {
   {"AegeanNumbers", xmlUCSIsAegeanNumbers},
   {"AlphabeticPresentationForms", xmlUCSIsAlphabeticPresentationForms},
   {"Arabic", xmlUCSIsArabic},
@@ -945,7 +945,7 @@ static xmlUnicodeNameTable xmlUnicodeCatTbl = 
{xmlUnicodeCats, 36};
 static xmlIntFunc
 *xmlUnicodeLookup(xmlUnicodeNameTable *tptr, const char *tname) {
     int low, high, mid, cmp;
-    xmlUnicodeRange *sptr;
+    const xmlUnicodeRange *sptr;
 
     if ((tptr == NULL) || (tname == NULL)) return(NULL);
 
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
https://mail.gnome.org/mailman/listinfo/xml

Reply via email to