!17 Upgrade to 1.1.3 version

Merge pull request !17 from houyingchao/master
This commit is contained in:
openeuler-ci-bot 2021-12-31 03:30:53 +00:00 committed by Gitee
commit 08ee1caebc
6 changed files with 5 additions and 89 deletions

Binary file not shown.

BIN
OpenCC-ver.1.1.3.tar.gz Normal file

Binary file not shown.

View File

@ -1,35 +0,0 @@
Index: OpenCC-ver.1.0.5/src/BinaryDict.cpp
===================================================================
--- OpenCC-ver.1.0.5.orig/src/BinaryDict.cpp
+++ OpenCC-ver.1.0.5/src/BinaryDict.cpp
@@ -63,6 +63,12 @@ void BinaryDict::SerializeToFile(FILE* f
}
BinaryDictPtr BinaryDict::NewFromFile(FILE* fp) {
+ size_t offsetBound, savedOffset;
+ savedOffset = ftell(fp);
+ fseek(fp, 0L, SEEK_END);
+ offsetBound = ftell(fp) - savedOffset;
+ fseek(fp, savedOffset, SEEK_SET);
+
BinaryDictPtr dict(new BinaryDict(LexiconPtr(new Lexicon)));
// Number of items
@@ -109,7 +115,7 @@ BinaryDictPtr BinaryDict::NewFromFile(FI
// Key offset
size_t keyOffset;
unitsRead = fread(&keyOffset, sizeof(size_t), 1, fp);
- if (unitsRead != 1) {
+ if (unitsRead != 1 || keyOffset >= offsetBound) {
throw InvalidFormat("Invalid OpenCC binary dictionary (keyOffset)");
}
const char* key = dict->keyBuffer.c_str() + keyOffset;
@@ -118,7 +124,7 @@ BinaryDictPtr BinaryDict::NewFromFile(FI
for (size_t j = 0; j < numValues; j++) {
size_t valueOffset;
unitsRead = fread(&valueOffset, sizeof(size_t), 1, fp);
- if (unitsRead != 1) {
+ if (unitsRead != 1 || valueOffset >= offsetBound) {
throw InvalidFormat("Invalid OpenCC binary dictionary (valueOffset)");
}
const char* value = dict->valueBuffer.c_str() + valueOffset;

View File

@ -1,26 +0,0 @@
Index: OpenCC-ver.1.0.5/CMakeLists.txt
===================================================================
--- OpenCC-ver.1.0.5.orig/CMakeLists.txt
+++ OpenCC-ver.1.0.5/CMakeLists.txt
@@ -68,7 +68,7 @@ set (DIR_PREFIX ${CMAKE_INSTALL_PREFIX})
set (DIR_INCLUDE ${DIR_PREFIX}/include/)
set (DIR_SHARE ${DIR_PREFIX}/share/)
set (DIR_ETC ${DIR_PREFIX}/etc/)
-set (DIR_LIBRARY ${DIR_PREFIX}/lib${LIB_SUFFIX}/)
+set (DIR_LIBRARY ${LIB_INSTALL_DIR})
if (DEFINED SHARE_INSTALL_PREFIX)
set (DIR_SHARE ${SHARE_INSTALL_PREFIX})
Index: OpenCC-ver.1.0.5/data/CMakeLists.txt
===================================================================
--- OpenCC-ver.1.0.5.orig/data/CMakeLists.txt
+++ OpenCC-ver.1.0.5/data/CMakeLists.txt
@@ -1,6 +1,6 @@
set(OPENCC_DICT_BIN opencc_dict)
-set(DICT_MERGE_BIN python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/merge.py)
-set(DICT_REVERSE_BIN python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/reverse.py)
+set(DICT_MERGE_BIN python3 ${CMAKE_CURRENT_SOURCE_DIR}/scripts/merge.py)
+set(DICT_REVERSE_BIN python3 ${CMAKE_CURRENT_SOURCE_DIR}/scripts/reverse.py)
set(DICT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dictionary)
set(DICT_GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR})

View File

@ -1,23 +0,0 @@
From 6a1e149b643d07b465b348e23a696f8df800cdc4 Mon Sep 17 00:00:00 2001
Subject: [PATCH] opencc stop copy
---
data/CMakeLists.txt | 2 --
1 file changed, 2 deletions(-)
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index 3989bad..c9b20c1 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -109,8 +109,6 @@ foreach(DICT ${DICTS})
${DICT}.ocd
COMMENT
"Building ${DICT}.ocd"
- COMMAND
- ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:libopencc>" "$<TARGET_FILE_DIR:${OPENCC_DICT_BIN}>"
COMMAND
${OPENCC_DICT_BIN}
--input ${DICT_${DICT}_INPUT}
--
2.23.0

View File

@ -1,13 +1,10 @@
Name: opencc
Version: 1.0.5
Release: 5
Version: 1.1.3
Release: 1
Summary: Simplified Chinese Traditional Conversion Library
License: ASL 2.0
URL: https://github.com/BYVoid/OpenCC
Source0: https://github.com/BYVoid/OpenCC/archive/ver.%{version}.tar.gz#/OpenCC-ver.%{version}.tar.gz
Patch0001: opencc-fixes-cmake.patch
Patch0002: opencc-check-bounds.patch
Patch0003: opencc-stop-copy.patch
Provides: %{name}-tools = %{version}-%{release}
Obsoletes: %{name}-tools < %{version}-%{release}
@ -68,6 +65,9 @@ ctest
%{_datadir}/opencc/doc
%changelog
* Fri Dec 31 2021 houyingchao <houyingchao@huawei.com> - 1.1.3-1
- Upgrade to 1.1.3 version
* Mon Jun 29 2020 huanghaitao <huanghaitao8@huawei.com> - 1.0.5-5
- Fix build error