commit 0dbd499331ba7a81c4ffcf501e7a25644cadab70 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 10:51:40 2019 -0400 Package init diff --git a/graphite-arm-nodefaultlibs.patch b/graphite-arm-nodefaultlibs.patch new file mode 100644 index 0000000..98ea4a0 --- /dev/null +++ b/graphite-arm-nodefaultlibs.patch @@ -0,0 +1,16 @@ +--- graphite2-1.2.0/src/CMakeLists.txt.orig 2012-11-09 17:48:04.908391335 +0800 ++++ graphite2-1.2.0/src/CMakeLists.txt 2012-11-09 17:48:48.647102280 +0800 +@@ -118,11 +118,7 @@ + if (${CMAKE_CXX_COMPILER} MATCHES ".*mingw.*") + target_link_libraries(graphite2 kernel32 msvcr90 mingw32 gcc user32) + else (${CMAKE_CXX_COMPILER} MATCHES ".*mingw.*") +- if (GRAPHITE2_ASAN) +- target_link_libraries(graphite2 c gcc_s) +- else (GRAPHITE2_ASAN) +- target_link_libraries(graphite2 c gcc) +- endif (GRAPHITE2_ASAN) ++ target_link_libraries(graphite2 c gcc_s) + include(Graphite) + nolib_test(stdc++ $) + endif (${CMAKE_CXX_COMPILER} MATCHES ".*mingw.*") + diff --git a/graphite2-1.2.0-cmakepath.patch b/graphite2-1.2.0-cmakepath.patch new file mode 100644 index 0000000..ee71cd6 --- /dev/null +++ b/graphite2-1.2.0-cmakepath.patch @@ -0,0 +1,9 @@ +diff -urN graphite2-1.2.0.orig/src/CMakeLists.txt graphite2-1.2.0/src/CMakeLists.txt +--- graphite2-1.2.0.orig/src/CMakeLists.txt 2013-01-29 15:47:32.465841769 +0530 ++++ graphite2-1.2.0/src/CMakeLists.txt 2013-01-29 15:48:24.056843352 +0530 +@@ -136,4 +136,4 @@ + + + install(TARGETS graphite2 EXPORT graphite2 LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} PUBLIC_HEADER DESTINATION include/graphite2 RUNTIME DESTINATION bin) +-install(EXPORT graphite2 DESTINATION share/graphite2 NAMESPACE gr2_) ++install(EXPORT graphite2 DESTINATION lib${LIB_SUFFIX}/graphite2 NAMESPACE gr2_) diff --git a/graphite2-1.3.10.tgz b/graphite2-1.3.10.tgz new file mode 100644 index 0000000..a891348 Binary files /dev/null and b/graphite2-1.3.10.tgz differ diff --git a/graphite2.spec b/graphite2.spec new file mode 100644 index 0000000..6b8978f --- /dev/null +++ b/graphite2.spec @@ -0,0 +1,87 @@ +Name: graphite2 +Version: 1.3.10 +Release: 7 +Summary: Graphite provides cross-platform rendering for complex writing systems + +License: (LGPLv2+ or GPLv2+ or MPL) and (Netscape or GPLv2+ or LGPLv2+) +URL: https://sourceforge.net/projects/silgraphite/ +Source0: https://downloads.sourceforge.net/project/silgraphite/graphite2//%{name}-%{version}.tgz + +#patchs from fedora +Patch0: graphite-arm-nodefaultlibs.patch +Patch1: graphite2-1.2.0-cmakepath.patch + +#patchs for backport +Patch6000: graphite2_1.3.6_CVE-2018-7999-2.patch + +BuildRequires: gcc gcc-c++ cmake freetype-devel doxygen asciidoc python-unversioned-command +BuildRequires: texlive-helvetic texlive-sectsty texlive-tocloft texlive-xtab texlive-multirow python2-fonttools + + +Obsoletes: silgraphite < 2.3.1-5 + + + + +%description +Graphite is a system that can be used to create “smart fonts” capable of displaying writing systems with various complex behaviors. A smart font contains not only letter shapes but also additional instructions indicating how to combine and position the letters in complex ways. + +%package devel +Summary: Development headers and libraries for graphite2 +Requires: %{name} = %{version}-%{release} + +Obsoletes: silgraphite-devel < 2.3.1-5 + +%description devel +Header files for using the graphite2 libraries. + + +%prep +%autosetup -n %{name}-%{version} -p1 + + +%build +%cmake -DGRAPHITE2_COMPARE_RENDERER=OFF . +%make_build all docs + +%install +%make_install INSTALL="install -p" + + +%check +ctest + +%pre + +%preun + + +%post -p /sbin/ldconfig + + +%postun -p /sbin/ldconfig + + +%files +%defattr(-,root,root) +%license LICENSE COPYING +%doc ChangeLog README.md +%{_bindir}/gr2fonttest +%{_libdir}/libgraphite2.so.3 +%{_libdir}/libgraphite2.so.3.0.1 +%exclude %{_libdir}/*.la + +%files devel +%doc doc/manual.html +%{_includedir}/graphite2 +%{_libdir}/libgraphite2.so +%{_libdir}/pkgconfig/graphite2.pc + +%{_libdir}/graphite2/graphite2*.cmake + + + + +%changelog +* Thu Sep 17 2019 hufeng - 1.3.10.7 +-Create graphite2 spec diff --git a/graphite2_1.3.6_CVE-2018-7999-2.patch b/graphite2_1.3.6_CVE-2018-7999-2.patch new file mode 100644 index 0000000..398032a --- /dev/null +++ b/graphite2_1.3.6_CVE-2018-7999-2.patch @@ -0,0 +1,236 @@ +From db132b4731a9b4c9534144ba3a18e65b390e9ff6 Mon Sep 17 00:00:00 2001 +From: Martin Hosken +Date: Tue, 6 Mar 2018 12:42:16 +0700 +Subject: [PATCH 1123/1209] Deprecate and make ineffective + gr_face_dumbRendering + +--- + include/graphite2/Font.h | 2 +- + src/GlyphCache.cpp | 91 ++++++++++++++++++------------------- + src/gr_face.cpp | 5 +- + tests/featuremap/CMakeLists.txt | 2 +- + tests/featuremap/featuremaptest.cpp | 7 ++- + tests/vm/CMakeLists.txt | 4 +- + 6 files changed, 53 insertions(+), 58 deletions(-) + +diff --git a/include/graphite2/Font.h b/include/graphite2/Font.h +index 729ebff..62b123b 100644 +--- a/include/graphite2/Font.h ++++ b/include/graphite2/Font.h +@@ -56,7 +56,7 @@ GR2_API void gr_engine_version(int *nMajor, int *nMinor, int *nBugFix); + enum gr_face_options { + /** No preload, no cmap caching, fail if the graphite tables are invalid */ + gr_face_default = 0, +- /** Dumb rendering will be enabled if the graphite tables are invalid */ ++ /** Dumb rendering will be enabled if the graphite tables are invalid. DEPRECATED. */ + gr_face_dumbRendering = 1, + /** preload glyphs at construction time */ + gr_face_preloadGlyphs = 2, +diff --git a/src/GlyphCache.cpp b/src/GlyphCache.cpp +index c4ab807..1acf7f9 100644 +--- a/src/GlyphCache.cpp ++++ b/src/GlyphCache.cpp +@@ -84,7 +84,7 @@ const SlantBox SlantBox::empty = {0,0,0,0}; + class GlyphCache::Loader + { + public: +- Loader(const Face & face, const bool dumb_font); //return result indicates success. Do not use if failed. ++ Loader(const Face & face); //return result indicates success. Do not use if failed. + + operator bool () const throw(); + unsigned short int units_per_em() const throw(); +@@ -115,7 +115,7 @@ private: + + + GlyphCache::GlyphCache(const Face & face, const uint32 face_options) +-: _glyph_loader(new Loader(face, bool(face_options & gr_face_dumbRendering))), ++: _glyph_loader(new Loader(face)), + _glyphs(_glyph_loader && *_glyph_loader && _glyph_loader->num_glyphs() + ? grzeroalloc(_glyph_loader->num_glyphs()) : 0), + _boxes(_glyph_loader && _glyph_loader->has_boxes() && _glyph_loader->num_glyphs() +@@ -239,7 +239,7 @@ const GlyphFace *GlyphCache::glyph(unsigned short glyphid) const //result m + + + +-GlyphCache::Loader::Loader(const Face & face, const bool dumb_font) ++GlyphCache::Loader::Loader(const Face & face) + : _head(face, Tag::head), + _hhea(face, Tag::hhea), + _hmtx(face, Tag::hmtx), +@@ -265,52 +265,49 @@ GlyphCache::Loader::Loader(const Face & face, const bool dumb_font) + return; + } + +- if (!dumb_font) ++ if ((m_pGlat = Face::Table(face, Tag::Glat, 0x00030000)) == NULL ++ || (m_pGloc = Face::Table(face, Tag::Gloc)) == NULL ++ || m_pGloc.size() < 8) + { +- if ((m_pGlat = Face::Table(face, Tag::Glat, 0x00030000)) == NULL +- || (m_pGloc = Face::Table(face, Tag::Gloc)) == NULL +- || m_pGloc.size() < 8) +- { +- _head = Face::Table(); +- return; +- } +- const byte * p = m_pGloc; +- int version = be::read(p); +- const uint16 flags = be::read(p); +- _num_attrs = be::read(p); +- // We can accurately calculate the number of attributed glyphs by +- // subtracting the length of the attribids array (numAttribs long if present) +- // and dividing by either 2 or 4 depending on shor or lonf format +- _long_fmt = flags & 1; +- int tmpnumgattrs = (m_pGloc.size() +- - (p - m_pGloc) +- - sizeof(uint16)*(flags & 0x2 ? _num_attrs : 0)) +- / (_long_fmt ? sizeof(uint32) : sizeof(uint16)) - 1; +- +- if (version >= 0x00020000 || tmpnumgattrs < 0 || tmpnumgattrs > 65535 +- || _num_attrs == 0 || _num_attrs > 0x3000 // is this hard limit appropriate? +- || _num_glyphs_graphics > tmpnumgattrs +- || m_pGlat.size() < 4) +- { +- _head = Face::Table(); +- return; +- } ++ _head = Face::Table(); ++ return; ++ } ++ const byte * p = m_pGloc; ++ int version = be::read(p); ++ const uint16 flags = be::read(p); ++ _num_attrs = be::read(p); ++ // We can accurately calculate the number of attributed glyphs by ++ // subtracting the length of the attribids array (numAttribs long if present) ++ // and dividing by either 2 or 4 depending on shor or lonf format ++ _long_fmt = flags & 1; ++ int tmpnumgattrs = (m_pGloc.size() ++ - (p - m_pGloc) ++ - sizeof(uint16)*(flags & 0x2 ? _num_attrs : 0)) ++ / (_long_fmt ? sizeof(uint32) : sizeof(uint16)) - 1; ++ ++ if (version >= 0x00020000 || tmpnumgattrs < 0 || tmpnumgattrs > 65535 ++ || _num_attrs == 0 || _num_attrs > 0x3000 // is this hard limit appropriate? ++ || _num_glyphs_graphics > tmpnumgattrs ++ || m_pGlat.size() < 4) ++ { ++ _head = Face::Table(); ++ return; ++ } + +- _num_glyphs_attributes = static_cast(tmpnumgattrs); +- p = m_pGlat; +- version = be::read(p); +- if (version >= 0x00040000 || (version >= 0x00030000 && m_pGlat.size() < 8)) // reject Glat tables that are too new +- { +- _head = Face::Table(); +- return; +- } +- else if (version >= 0x00030000) +- { +- unsigned int glatflags = be::read(p); +- _has_boxes = glatflags & 1; +- // delete this once the compiler is fixed +- _has_boxes = true; +- } ++ _num_glyphs_attributes = static_cast(tmpnumgattrs); ++ p = m_pGlat; ++ version = be::read(p); ++ if (version >= 0x00040000 || (version >= 0x00030000 && m_pGlat.size() < 8)) // reject Glat tables that are too new ++ { ++ _head = Face::Table(); ++ return; ++ } ++ else if (version >= 0x00030000) ++ { ++ unsigned int glatflags = be::read(p); ++ _has_boxes = glatflags & 1; ++ // delete this once the compiler is fixed ++ _has_boxes = true; + } + } + +diff --git a/src/gr_face.cpp b/src/gr_face.cpp +index fe1eb83..07244cc 100644 +--- a/src/gr_face.cpp ++++ b/src/gr_face.cpp +@@ -47,8 +47,7 @@ namespace + telemetry::category _misc_cat(face.tele.misc); + #endif + Face::Table silf(face, Tag::Silf, 0x00050000); +- if (silf) options &= ~gr_face_dumbRendering; +- else if (!(options & gr_face_dumbRendering)) ++ if (!silf) + return false; + + if (!face.readGlyphs(options)) +@@ -74,7 +73,7 @@ namespace + return true; + } + else +- return options & gr_face_dumbRendering; ++ return false; + } + } + +diff --git a/tests/featuremap/CMakeLists.txt b/tests/featuremap/CMakeLists.txt +index fc57f96..a438f66 100644 +--- a/tests/featuremap/CMakeLists.txt ++++ b/tests/featuremap/CMakeLists.txt +@@ -20,7 +20,7 @@ if (GRAPHITE2_ASAN) + endif (GRAPHITE2_ASAN) + target_link_libraries(featuremaptest graphite2 graphite2-base graphite2-segcache graphite2-base) + +-add_test(NAME featuremaptest COMMAND $ ${testing_SOURCE_DIR}/fonts/tiny.ttf) ++add_test(NAME featuremaptest COMMAND $ ${testing_SOURCE_DIR}/fonts/small.ttf) + set_tests_properties(featuremaptest PROPERTIES TIMEOUT 3) + if (GRAPHITE2_ASAN) + set_property(TEST featuremaptest APPEND PROPERTY ENVIRONMENT "ASAN_SYMBOLIZER_PATH=${ASAN_SYMBOLIZER}") +diff --git a/tests/featuremap/featuremaptest.cpp b/tests/featuremap/featuremaptest.cpp +index fcd9b87..a9aa497 100644 +--- a/tests/featuremap/featuremaptest.cpp ++++ b/tests/featuremap/featuremaptest.cpp +@@ -243,7 +243,7 @@ template void testFeatTable(const T & table, const char * testName) + { + FeatureMap testFeatureMap; + dummyFace.replace_table(TtfUtil::Tag::Feat, &table, sizeof(T)); +- gr_face * face = gr_make_face_with_ops(&dummyFace, &face_handle::ops, gr_face_dumbRendering); ++ gr_face * face = gr_make_face_with_ops(&dummyFace, &face_handle::ops, 0); + if (!face) throw std::runtime_error("failed to load font"); + bool readStatus = testFeatureMap.readFeats(*face); + testAssert("readFeats", readStatus); +@@ -285,9 +285,8 @@ int main(int argc, char * argv[]) + // test a bad settings offset stradling the end of the table + FeatureMap testFeatureMap; + dummyFace.replace_table(TtfUtil::Tag::Feat, &testBadOffset, sizeof testBadOffset); +- face = gr_make_face_with_ops(&dummyFace, &face_handle::ops, gr_face_dumbRendering); +- bool readStatus = testFeatureMap.readFeats(*face); +- testAssert("fail gracefully on bad table", !readStatus); ++ face = gr_make_face_with_ops(&dummyFace, &face_handle::ops, 0); ++ testAssert("fail gracefully on bad table", !face); + } + catch (std::exception & e) + { +diff --git a/tests/vm/CMakeLists.txt b/tests/vm/CMakeLists.txt +index 4a0b823..24fbd3b 100644 +--- a/tests/vm/CMakeLists.txt ++++ b/tests/vm/CMakeLists.txt +@@ -41,7 +41,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + endif ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") + endif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + +-add_test(vm-test-call-threading vm-test-call ${testing_SOURCE_DIR}/fonts/tiny.ttf 1) ++add_test(vm-test-call-threading vm-test-call ${testing_SOURCE_DIR}/fonts/small.ttf 1) + set_tests_properties(vm-test-call-threading PROPERTIES + PASS_REGULAR_EXPRESSION "simple program size: 14 bytes.*result of program: 42" + FAIL_REGULAR_EXPRESSION "program terminated early;stack not empty") +@@ -51,7 +51,7 @@ if (GRAPHITE2_ASAN) + endif (GRAPHITE2_ASAN) + + if (${CMAKE_COMPILER_IS_GNUCXX}) +- add_test(vm-test-direct-threading vm-test-direct ${testing_SOURCE_DIR}/fonts/tiny.ttf 1) ++ add_test(vm-test-direct-threading vm-test-direct ${testing_SOURCE_DIR}/fonts/small.ttf 1) + set_tests_properties(vm-test-direct-threading PROPERTIES + PASS_REGULAR_EXPRESSION "simple program size: 14 bytes.*result of program: 42" + FAIL_REGULAR_EXPRESSION "program terminated early;stack not empty")