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
|
diff --git a/contrib/harfbuzz-unicode.c b/contrib/harfbuzz-unicode.c
index 51dd4ea..cb7a85b 100644
--- a/contrib/harfbuzz-unicode.c
+++ b/contrib/harfbuzz-unicode.c
@@ -171,7 +171,10 @@ hb_utf16_script_run_prev(unsigned *num_code_points, HB_ScriptItem *output,
current_script = script;
continue;
} else if (script == HB_Script_Inherited) {
- current_script = script;
+ // Just assume that whatever follows this combining character is within
+ // the same script. This is incorrect if you had language1 + combining
+ // char + language 2, but that is rare and this code is suspicious
+ // anyway.
continue;
} else {
*iter = prev_iter;
diff --git a/src/harfbuzz-gpos.c b/src/harfbuzz-gpos.c
index 356dc01..db5ea0a 100644
--- a/src/harfbuzz-gpos.c
+++ b/src/harfbuzz-gpos.c
@@ -2976,6 +2976,9 @@ static HB_Error Lookup_MarkMarkPos( GPOS_Instance* gpi,
j--;
}
+ if ( i > buffer->in_pos )
+ return HB_Err_Not_Covered;
+
error = _HB_OPEN_Coverage_Index( &mmp->Mark2Coverage, IN_GLYPH( j ),
&mark2_index );
if ( error )
diff --git a/src/harfbuzz-shaper.cpp b/src/harfbuzz-shaper.cpp
index f3ec8e1..2b52221 100644
--- a/src/harfbuzz-shaper.cpp
+++ b/src/harfbuzz-shaper.cpp
@@ -433,7 +433,7 @@ void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item)
// ### zeroWidth and justification are missing here!!!!!
- assert(item->num_glyphs <= length);
+ assert(length <= item->num_glyphs);
// qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item->num_glyphs);
HB_GlyphAttributes *attributes = item->attributes;
@@ -451,7 +451,6 @@ void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item)
}
++glyph_pos;
}
- assert(glyph_pos == item->num_glyphs);
// first char in a run is never (treated as) a mark
int cStart = 0;
@@ -1151,10 +1150,11 @@ HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_uint32 *properties)
return false;
face->tmpLogClusters = tmpLogClusters;
+ const int itemLength = item->item.length;
for (int i = 0; i < face->length; ++i) {
hb_buffer_add_glyph(face->buffer, item->glyphs[i], properties ? properties[i] : 0, i);
face->tmpAttributes[i] = item->attributes[i];
- face->tmpLogClusters[i] = item->log_clusters[i];
+ face->tmpLogClusters[i] = i < itemLength ? item->log_clusters[i] : item->log_clusters[itemLength - 1];
}
#ifdef OT_DEBUG
|