Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: third_party/harfbuzz/chromium.patch

Issue 7465036: OOB read in harfbuzz with khmer character. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added an assertion. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | third_party/harfbuzz/src/harfbuzz-shaper.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 diff --git a/contrib/harfbuzz-unicode.c b/contrib/harfbuzz-unicode.c 1 diff --git a/contrib/harfbuzz-unicode.c b/contrib/harfbuzz-unicode.c
2 index 51dd4ea..cb7a85b 100644 2 index 51dd4ea..cb7a85b 100644
3 --- a/contrib/harfbuzz-unicode.c 3 --- a/contrib/harfbuzz-unicode.c
4 +++ b/contrib/harfbuzz-unicode.c 4 +++ b/contrib/harfbuzz-unicode.c
5 @@ -171,7 +171,10 @@ hb_utf16_script_run_prev(unsigned *num_code_points, HB_Scri ptItem *output, 5 @@ -171,7 +171,10 @@ hb_utf16_script_run_prev(unsigned *num_code_points, HB_Scri ptItem *output,
6 current_script = script; 6 current_script = script;
7 continue; 7 continue;
8 } else if (script == HB_Script_Inherited) { 8 } else if (script == HB_Script_Inherited) {
9 - current_script = script; 9 - current_script = script;
10 + // Just assume that whatever follows this combining character is within 10 + // Just assume that whatever follows this combining character is within
11 + // the same script. This is incorrect if you had language1 + combining 11 + // the same script. This is incorrect if you had language1 + combining
12 + // char + language 2, but that is rare and this code is suspicious 12 + // char + language 2, but that is rare and this code is suspicious
13 + // anyway. 13 + // anyway.
14 continue; 14 continue;
15 } else { 15 } else {
16 *iter = prev_iter; 16 *iter = prev_iter;
17 diff --git a/src/harfbuzz-gpos.c b/src/harfbuzz-gpos.c
18 index 356dc01..db5ea0a 100644
19 --- a/src/harfbuzz-gpos.c
20 +++ b/src/harfbuzz-gpos.c
21 @@ -2976,6 +2976,9 @@ static HB_Error Lookup_MarkMarkPos( GPOS_Instance* gpi ,
22 j--;
23 }
24
25 + if ( i > buffer->in_pos )
26 + return HB_Err_Not_Covered;
27 +
28 error = _HB_OPEN_Coverage_Index( &mmp->Mark2Coverage, IN_GLYPH( j ),
29 &mark2_index );
30 if ( error )
17 diff --git a/src/harfbuzz-shaper.cpp b/src/harfbuzz-shaper.cpp 31 diff --git a/src/harfbuzz-shaper.cpp b/src/harfbuzz-shaper.cpp
18 index f3ec8e1..2b0dfde 100644 32 index f3ec8e1..2b52221 100644
19 --- a/src/harfbuzz-shaper.cpp 33 --- a/src/harfbuzz-shaper.cpp
20 +++ b/src/harfbuzz-shaper.cpp 34 +++ b/src/harfbuzz-shaper.cpp
21 @@ -433,7 +433,7 @@ void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item) 35 @@ -433,7 +433,7 @@ void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item)
22 36
23 // ### zeroWidth and justification are missing here!!!!! 37 // ### zeroWidth and justification are missing here!!!!!
24 38
25 - assert(item->num_glyphs <= length); 39 - assert(item->num_glyphs <= length);
26 + assert(length <= item->num_glyphs); 40 + assert(length <= item->num_glyphs);
27 41
28 // qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item ->num_glyphs); 42 // qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item ->num_glyphs);
29 HB_GlyphAttributes *attributes = item->attributes; 43 HB_GlyphAttributes *attributes = item->attributes;
30 @@ -451,7 +451,6 @@ void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item) 44 @@ -451,7 +451,6 @@ void HB_HeuristicSetGlyphAttributes(HB_ShaperItem *item)
31 } 45 }
32 ++glyph_pos; 46 ++glyph_pos;
33 } 47 }
34 - assert(glyph_pos == item->num_glyphs); 48 - assert(glyph_pos == item->num_glyphs);
35 49
36 // first char in a run is never (treated as) a mark 50 // first char in a run is never (treated as) a mark
37 int cStart = 0; 51 int cStart = 0;
38 diff --git a/src/harfbuzz-gpos.c b/src/harfbuzz-gpos.c 52 @@ -1151,10 +1150,11 @@ HB_Bool HB_OpenTypeShape(HB_ShaperItem *item, const hb_u int32 *properties)
39 index 356dc01..db5ea0a 100644 53 return false;
40 --- a/src/harfbuzz-gpos.c 54 face->tmpLogClusters = tmpLogClusters;
41 +++ b/src/harfbuzz-gpos.c
42 @@ -2976,6 +2976,9 @@ static HB_Error Lookup_MarkMarkPos( GPOS_Instance* gpi ,
43 j--;
44 }
45 55
46 + if ( i > buffer->in_pos ) 56 + const int itemLength = item->item.length;
47 + return HB_Err_Not_Covered; 57 for (int i = 0; i < face->length; ++i) {
48 + 58 hb_buffer_add_glyph(face->buffer, item->glyphs[i], properties ? propert ies[i] : 0, i);
49 error = _HB_OPEN_Coverage_Index( &mmp->Mark2Coverage, IN_GLYPH( j ), 59 face->tmpAttributes[i] = item->attributes[i];
50 &mark2_index ); 60 - face->tmpLogClusters[i] = item->log_clusters[i];
51 if ( error ) 61 + face->tmpLogClusters[i] = i < itemLength ? item->log_clusters[i] : item ->log_clusters[itemLength - 1];
62 }
63
64 #ifdef OT_DEBUG
OLDNEW
« no previous file with comments | « no previous file | third_party/harfbuzz/src/harfbuzz-shaper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698