Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Peng Wu
ef18f27c8a Import SRPM 2023-12-08 14:00:56 +08:00
5 changed files with 263 additions and 0 deletions

1
.gitignore vendored
View file

@ -0,0 +1 @@
/OpenCC-ver.1.0.5.tar.gz

35
opencc-check-bounds.patch Normal file
View file

@ -0,0 +1,35 @@
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;

26
opencc-fixes-cmake.patch Normal file
View file

@ -0,0 +1,26 @@
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})

200
opencc.spec Normal file
View file

@ -0,0 +1,200 @@
Name: opencc
Version: 1.0.5
Release: 3%{?dist}
Summary: Libraries for Simplified-Traditional Chinese Conversion
License: ASL 2.0
Group: System Environment/Libraries
URL: https://github.com/BYVoid/OpenCC
Source0: https://github.com/BYVoid/OpenCC/archive/ver.%{version}.tar.gz#/OpenCC-ver.%{version}.tar.gz
Patch1: opencc-fixes-cmake.patch
Patch2: opencc-check-bounds.patch
BuildRequires: gcc-c++
BuildRequires: gettext
BuildRequires: cmake
BuildRequires: doxygen
BuildRequires: python3
%description
OpenCC is a library for converting characters and phrases between
Traditional Chinese and Simplified Chinese.
%package doc
Summary: Documentation for OpenCC
Group: Applications/Text
Requires: %{name} = %{version}-%{release}
%description doc
Doxygen generated documentation for OpenCC.
%package tools
Summary: Command line tools for OpenCC
Group: Applications/Text
Requires: %{name} = %{version}-%{release}
%description tools
Command line tools for OpenCC, including tools for conversion via CLI and
for building dictionaries.
%package devel
Summary: Development files for OpenCC
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%prep
%setup -q -n OpenCC-ver.%{version}
%patch1 -p1 -b .cmake
%patch2 -p1 -b .bounds
%build
%cmake . -DENABLE_GETTEXT:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON
make VERBOSE=1 %{?_smp_mflags}
%install
make install DESTDIR=$RPM_BUILD_ROOT
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
%check
ctest
#%find_lang %{name}
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc AUTHORS LICENSE README.md
%{_libdir}/lib*.so.*
%{_datadir}/opencc/
%exclude %{_datadir}/opencc/doc
%files doc
%{_datadir}/opencc/doc
%files tools
%{_bindir}/*
%files devel
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%changelog
* Wed Oct 17 2018 Peng Wu <pwu@redhat.com> - 1.0.5-3
- Security fix for CVE-2018-16982
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Jun 28 2018 Peng Wu <pwu@redhat.com> - 1.0.5-1
- Update to 1.0.5
* Mon Mar 19 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.0.3-7
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Mon May 15 2017 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Feb 16 2016 Peng Wu <pwu@redhat.com> - 1.0.3-1
- Update to 1.0.3
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 1.0.2-3
- Rebuilt for GCC 5 C++11 ABI change
* Mon Jan 19 2015 Peng Wu <pwu@redhat.com> - 1.0.2-2
- Fixes postun script
* Tue Jan 6 2015 Peng Wu <pwu@redhat.com> - 1.0.2-1
- Update to 1.0.2
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Tue May 28 2013 Peng Wu <pwu@redhat.com> - 0.4.3-1
- Update to 0.4.3
* Mon Mar 4 2013 Peng Wu <pwu@redhat.com> - 0.4.0-1
- Update to 0.4.0
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Wed Aug 22 2012 Peng Wu <pwu@redhat.com> - 0.3.0-4
- Fixes Download URL
* Mon Jul 23 2012 Peng Wu <pwu@redhat.com> - 0.3.0-3
- Fixes cmake
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Thu Feb 02 2012 Peng Wu <pwu@redhat.com> - 0.3.0-1
- Update to 0.3.0, and fixes ctest
* Wed Feb 1 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 0.2.0-6
- Drop unnessary ExclusiveArch directive
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Wed Nov 30 2011 Peng Wu <pwu@redhat.com> - 0.2.0-4
- Change i386 to i686
* Wed Nov 30 2011 Peng Wu <pwu@redhat.com> - 0.2.0-3
- Only build for i386 and x86_64
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Sat Dec 25 2010 BYVoid <byvoid.kcp@gmail.com> - 0.2.0-1
- Upstream release.
- Use CMake instead of autotools.
* Wed Sep 29 2010 jkeating - 0.1.2-2
- Rebuilt for gcc bug 634757
* Fri Sep 17 2010 BYVoid <byvoid.kcp@gmail.com> - 0.1.2-1
- Upstream release.
* Thu Aug 12 2010 BYVoid <byvoid.kcp@gmail.com> - 0.1.1-1
- Upstream release.
* Thu Jul 29 2010 BYVoid <byvoid.kcp@gmail.com> - 0.1.0-1
- Upstream release.
* Fri Jul 16 2010 BYVoid <byvoid.kcp@gmail.com> - 0.0.4-1
- Initial release of RPM.

View file

@ -0,0 +1 @@
SHA512 (OpenCC-ver.1.0.5.tar.gz) = 3fbefbafe5c3c2491032158577ab97b5a3edf6ea98a03a7250deba082b72c3112ad4a3396d1a469936ec32e1d141f0a2236001c2891ac9c793add2b082596cc1