From 76e469beea759b60db5ec9cd2467b35c77e1b941 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 9 Aug 2016 12:57:47 +0800 Subject: [PATCH] Fixes crashes for Full Pinyin and Bopomofo --- libpinyin-1.6.x-head.patch | 32 ++++++++++++++++++++++++++++++++ libpinyin.spec | 7 +++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/libpinyin-1.6.x-head.patch b/libpinyin-1.6.x-head.patch index e69de29..e23851c 100644 --- a/libpinyin-1.6.x-head.patch +++ b/libpinyin-1.6.x-head.patch @@ -0,0 +1,32 @@ +diff --git a/src/pinyin.cpp b/src/pinyin.cpp +index ac72623..6d8738c 100644 +--- a/src/pinyin.cpp ++++ b/src/pinyin.cpp +@@ -2506,7 +2506,7 @@ 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; + + ++length; + +@@ -2530,6 +2530,9 @@ bool pinyin_get_character_offset(pinyin_instance_t * instance, + pinyin_context_t * context = instance->m_context; + PhoneticKeyMatrix & matrix = instance->m_matrix; + ++ if (0 == matrix.size()) ++ return false; ++ + assert(offset < matrix.size()); + _check_offset(matrix, offset); + +@@ -2973,7 +2976,7 @@ static bool _remember_phrase_recur(pinyin_instance_t * instance, + + gfloat pinyin_poss = item.get_pronunciation_possibility(&key); + if (pinyin_poss < FLT_EPSILON) +- return false; ++ continue; + + /* push value */ + g_array_append_val(cached_keys, key); diff --git a/libpinyin.spec b/libpinyin.spec index fbf5a84..4da7678 100644 --- a/libpinyin.spec +++ b/libpinyin.spec @@ -1,8 +1,8 @@ -%global snapshot 0 +%global snapshot 1 Name: libpinyin Version: 1.5.92 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Library to deal with pinyin License: GPLv2+ @@ -92,6 +92,9 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' %changelog +* Tue Aug 9 2016 Peng Wu - 1.5.92-2 +- Fixes crashes for Full Pinyin and Bopomofo + * Tue Aug 2 2016 Peng Wu - 1.5.92-1 - Update to 1.5.92