diff --git a/libpinyin-1.6.x-head.patch b/libpinyin-1.6.x-head.patch index e23851c..85a096c 100644 --- a/libpinyin-1.6.x-head.patch +++ b/libpinyin-1.6.x-head.patch @@ -1,13 +1,26 @@ diff --git a/src/pinyin.cpp b/src/pinyin.cpp -index ac72623..6d8738c 100644 +index ac72623..29c4c8c 100644 --- a/src/pinyin.cpp +++ b/src/pinyin.cpp -@@ -2506,7 +2506,7 @@ static bool _get_char_offset_recur(pinyin_instance_t * instance, +@@ -2488,9 +2488,6 @@ static bool _get_char_offset_recur(pinyin_instance_t * instance, + + const size_t newstart = key_rest.m_raw_end; + +- if (newstart > offset) +- return true; +- + const ChewingKey zero_key; + if (zero_key == key) { + /* assume only one key here for "'" or the last key. */ +@@ -2506,7 +2503,10 @@ static bool _get_char_offset_recur(pinyin_instance_t * instance, gfloat pinyin_poss = item.get_pronunciation_possibility(&key); if (pinyin_poss < FLT_EPSILON) - return false; + continue; ++ ++ if (newstart > offset) ++ return true; ++length; @@ -30,3 +43,20 @@ index ac72623..6d8738c 100644 /* push value */ g_array_append_val(cached_keys, key); +diff --git a/src/storage/phonetic_key_matrix.cpp b/src/storage/phonetic_key_matrix.cpp +index 8f8bd4a..da8d06f 100644 +--- a/src/storage/phonetic_key_matrix.cpp ++++ b/src/storage/phonetic_key_matrix.cpp +@@ -497,8 +497,10 @@ gfloat compute_pronunciation_possibility(PhoneticKeyMatrix * matrix, + PhraseItem & item){ + assert(end < matrix->size()); + +- assert(matrix->get_column_size(start) > 0); +- assert(matrix->get_column_size(end) > 0); ++ if(matrix->get_column_size(start) <= 0) ++ return 0.; ++ if(matrix->get_column_size(end) <= 0) ++ return 0.; + + g_array_set_size(cached_keys, 0); + return compute_pronunciation_possibility_recur diff --git a/libpinyin.spec b/libpinyin.spec index 4da7678..6d18578 100644 --- a/libpinyin.spec +++ b/libpinyin.spec @@ -2,7 +2,7 @@ Name: libpinyin Version: 1.5.92 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Library to deal with pinyin License: GPLv2+ @@ -92,6 +92,9 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' %changelog +* Mon Aug 15 2016 Peng Wu - 1.5.92-3 +- Fixes crashes again + * Tue Aug 9 2016 Peng Wu - 1.5.92-2 - Fixes crashes for Full Pinyin and Bopomofo