aboutsummaryrefslogblamecommitdiff
path: root/www/waterfox/files/patch-bug1440943
blob: 8840500cd8d1d12f3901c3dfb28391ead7e0a4b0 (plain) (tree)



























































                                                                                                                                                                     
commit 00e6df2e9693
Author: Jonathan Kew <jkew@mozilla.com>
Date:   Tue Feb 27 10:34:25 2018 +0000

    Bug 1440943 - Make GetScriptTagForCode safely return UNKNOWN tag if called with a script code that is out of range for the system ICU version. r=m_kato, a=RyanVM
    
    --HG--
    extra : source : 03a12246dd84ae384f973e148cec64662383e588
---
 intl/unicharutil/util/nsUnicodeProperties.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git intl/unicharutil/util/nsUnicodeProperties.h intl/unicharutil/util/nsUnicodeProperties.h
index e2ee2a99bfe4..57cff6bc5562 100644
--- intl/unicharutil/util/nsUnicodeProperties.h
+++ intl/unicharutil/util/nsUnicodeProperties.h
@@ -119,7 +119,11 @@ inline uint32_t
 GetScriptTagForCode(Script aScriptCode)
 {
   const char* tag = uscript_getShortName(UScriptCode(aScriptCode));
-  return HB_TAG(tag[0], tag[1], tag[2], tag[3]);
+  if (tag) {
+    return HB_TAG(tag[0], tag[1], tag[2], tag[3]);
+  }
+  // return UNKNOWN script tag (running with older ICU?)
+  return HB_SCRIPT_UNKNOWN;
 }
 
 inline PairedBracketType
commit 412f5f20ada0
Author: Jonathan Kew <jkew@mozilla.com>
Date:   Tue Feb 27 10:34:25 2018 +0000

    Bug 1440943 - Ensure we don't try to look up script tags for codes that are not supported by the system ICU version. r=m_kato, a=RyanVM
    
    --HG--
    extra : source : 34d3a58cafc25d01d081195d2a396bc77342bf2c
---
 gfx/thebes/gfxFont.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git gfx/thebes/gfxFont.cpp gfx/thebes/gfxFont.cpp
index 1409cb087514..e4d04ffd48f5 100644
--- gfx/thebes/gfxFont.cpp
+++ gfx/thebes/gfxFont.cpp
@@ -1193,7 +1193,13 @@ gfxFont::CheckForFeaturesInvolvingSpace()
                 new nsDataHashtable<nsUint32HashKey,
                                     Script>(size_t(Script::NUM_SCRIPT_CODES));
             sScriptTagToCode->Put(HB_TAG('D','F','L','T'), Script::COMMON);
-            for (Script s = Script::ARABIC; s < Script::NUM_SCRIPT_CODES;
+            // Ensure that we don't try to look at script codes beyond what the
+            // current version of ICU (at runtime -- in case of system ICU)
+            // knows about.
+            Script scriptCount =
+                Script(std::min<int>(u_getIntPropertyMaxValue(UCHAR_SCRIPT) + 1,
+                                     int(Script::NUM_SCRIPT_CODES)));
+            for (Script s = Script::ARABIC; s < scriptCount;
                  s = Script(static_cast<int>(s) + 1)) {
                 hb_script_t scriptTag = hb_script_t(GetScriptTagForCode(s));
                 hb_tag_t s1, s2;