From 52c0c70cfdc1234d0bd0759324a5b49259d6cfe5 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Feb 28 2017 03:09:10 +0000 Subject: Fixes crash in Double Pinyin --- diff --git a/libpinyin-2.0.x-head.patch b/libpinyin-2.0.x-head.patch index e69de29..9861c80 100644 --- a/libpinyin-2.0.x-head.patch +++ b/libpinyin-2.0.x-head.patch @@ -0,0 +1,27 @@ +diff --git a/src/include/memory_chunk.h b/src/include/memory_chunk.h +index 83b8ad9..044fa0d 100644 +--- a/src/include/memory_chunk.h ++++ b/src/include/memory_chunk.h +@@ -60,7 +60,7 @@ private: + char * m_allocated; //one data pass the end. + free_func_t m_free_func; + +- const guint32 header = sizeof(guint32) * 2; ++ const gint32 header = sizeof(guint32) * 2; + + private: + void freemem(){ +diff --git a/src/pinyin.cpp b/src/pinyin.cpp +index 1a5132e..57defcc 100644 +--- a/src/pinyin.cpp ++++ b/src/pinyin.cpp +@@ -1172,6 +1172,9 @@ bool pinyin_get_sentence(pinyin_instance_t * instance, + pinyin_context_t * & context = instance->m_context; + NBestMatchResults & results = instance->m_nbest_results; + ++ if (0 == results.size()) ++ return false; ++ + MatchResult result = NULL; + assert(index < results.size()); + assert(results.get_result(index, result)); diff --git a/libpinyin.spec b/libpinyin.spec index b429a50..898e0f8 100644 --- a/libpinyin.spec +++ b/libpinyin.spec @@ -1,8 +1,8 @@ -%global snapshot 0 +%global snapshot 1 Name: libpinyin Version: 1.9.91 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Library to deal with pinyin License: GPLv3+ @@ -92,6 +92,9 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' %changelog +* Tue Feb 28 2017 Peng Wu - 1.9.91-2 +- Fixes crash in Double Pinyin + * Tue Feb 14 2017 Peng Wu - 1.9.91-1 - Update to 1.9.91 - multiple sentence candidates