diff --git src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index 76c5177..0a564c1 100644 --- src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -464,6 +464,15 @@ void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item) // ### zeroWidth and justification are missing here!!!!! assert(item->num_glyphs <= length); + // RJVB: runtime assert and account for situations that can occur with newer HB versions + if (static_cast(length) <= 0 || item->num_glyphs > length) { + return; + } +// if (length > item->num_glyphs) { +// fprintf(stderr, "QScriptEngine::heuristicSetGlyphAttributes, setting length=%u to num_glyphs=%d\n", +// length, item->num_glyphs); +// length = item->num_glyphs; +// } // qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item->num_glyphs); HB_GlyphAttributes *attributes = item->attributes; @@ -562,10 +571,12 @@ void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item) lastCat = cat; } pos = logClusters[length-1]; - if (lastCat == HB_Separator_Space) - attributes[pos].justification = HB_Space; - else - attributes[pos].justification = HB_Character; + if (attributes && pos>= 0 && pos < item->num_glyphs) { + if (lastCat == HB_Separator_Space) + attributes[pos].justification = HB_Space; + else + attributes[pos].justification = HB_Character; + } } #ifndef NO_OPENTYPE