.circleci/config.yml | 52 ++++++++++++++++++++++++++++++++++++++++++++++ src/hb-blob.cc | 27 +++++++++++++++++++++++ src/hb-ot-post-table.hh | 1 src/hb.hh | 4 ++- test/api/hb-subset-test.h | 12 +++++++--- test/api/test-font.c | 1 test/api/test-ot-math.c | 4 +++ test/api/test-set.c | 1 test/shaping/run-tests.py | 2 - 9 files changed, 99 insertions(+), 5 deletions(-)
New commits: commit d7f21777e6a797758ab234555f5f7e07c87278f9 Author: Behdad Esfahbod <[email protected]> Date: Sun Sep 23 19:12:52 2018 -0400 [ot-font] Fix leak Fixes https://github.com/harfbuzz/harfbuzz/issues/1171 I'm glad we have leak-detector bots now. diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh index 5f27fd50..f81de37d 100644 --- a/src/hb-ot-post-table.hh +++ b/src/hb-ot-post-table.hh @@ -131,6 +131,7 @@ struct post { index_to_offset.fini (); free (gids_sorted_by_name.get ()); + hb_blob_destroy (blob); } inline bool get_glyph_name (hb_codepoint_t glyph, commit ae39a53f55e6b812defb4c7b48562651c9eb13a3 Author: Ebrahim Byagowi <[email protected]> Date: Sat Sep 22 14:22:17 2018 +0330 Add bots with address- and thread-sanitizer diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ad1ae13..671f49d7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -79,6 +79,54 @@ jobs: - run: make - run: LD_LIBRARY_PATH="$PWD/freetype-2.9/objs/.libs" make check || .ci/fail.sh + clang-asan: + docker: + - image: ubuntu:18.04 + steps: + - checkout + - run: apt update || true + - run: apt install -y clang-6.0 binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: pip install fonttools + - run: CPPFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address" CC=clang-6.0 CXX=clang++-6.0 ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: make + - run: make check || .ci/fail.sh + + clang-msan: + docker: + - image: ubuntu:18.04 + steps: + - checkout + - run: apt update || true + - run: apt install -y clang-6.0 binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: pip install fonttools + - run: CPPFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" CC=clang-6.0 CXX=clang++-6.0 ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: make + - run: make check || .ci/fail.sh + + clang-tsan: + docker: + - image: ubuntu:18.04 + steps: + - checkout + - run: apt update || true + - run: apt install -y clang-6.0 binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: pip install fonttools + - run: CPPFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread" CC=clang-6.0 CXX=clang++-6.0 ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: make + - run: make check || .ci/fail.sh + + clang-ubsan: + docker: + - image: ubuntu:18.04 + steps: + - checkout + - run: apt update || true + - run: apt install -y clang-6.0 binutils libtool autoconf automake make pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: pip install fonttools + - run: CPPFLAGS="-fsanitize=undefined" LDFLAGS="-fsanitize=undefined" CC=clang-6.0 CXX=clang++-6.0 ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: make + - run: make check || .ci/fail.sh + fedora-outoftreebuild: docker: - image: fedora @@ -200,6 +248,10 @@ workflows: - alpine-O3-NOMMAP - archlinux-debug-O0-py3 - clang-O3-O0 + - clang-asan + - clang-msan + - clang-tsan + - clang-ubsan - fedora-outoftreebuild # cmake based builds commit 24dd6c1a9d8d571c30dce4d39c1975b1d1cedc2a Author: Matt Oliver <[email protected]> Date: Sun Sep 23 18:08:30 2018 +1000 src/hb-blob.cc: Fix mmap functionality with UWP. diff --git a/src/hb-blob.cc b/src/hb-blob.cc index a335df30..fca3c910 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -574,18 +574,45 @@ fail_without_close: wchar_t * wchar_file_name = (wchar_t *) malloc (sizeof (wchar_t) * size); if (unlikely (wchar_file_name == nullptr)) goto fail_without_close; mbstowcs (wchar_file_name, file_name, size); +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) + { + CREATEFILE2_EXTENDED_PARAMETERS ceparams = { 0 }; + ceparams.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS); + ceparams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED & 0xFFFF; + ceparams.dwFileFlags = FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED & 0xFFF00000; + ceparams.dwSecurityQosFlags = FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED & 0x000F0000; + ceparams.lpSecurityAttributes = nullptr; + ceparams.hTemplateFile = nullptr; + fd = CreateFile2 (wchar_file_name, GENERIC_READ, FILE_SHARE_READ, + OPEN_EXISTING, &ceparams); + } +#else fd = CreateFileW (wchar_file_name, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OVERLAPPED, nullptr); +#endif free (wchar_file_name); if (unlikely (fd == INVALID_HANDLE_VALUE)) goto fail_without_close; +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) + { + LARGE_INTEGER length; + GetFileSizeEx (fd, &length); + file->length = length.LowPart; + file->mapping = CreateFileMappingFromApp (fd, nullptr, PAGE_READONLY, length.QuadPart, nullptr); + } +#else file->length = (unsigned long) GetFileSize (fd, nullptr); file->mapping = CreateFileMapping (fd, nullptr, PAGE_READONLY, 0, 0, nullptr); +#endif if (unlikely (file->mapping == nullptr)) goto fail; +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) + file->contents = (char *) MapViewOfFileFromApp (file->mapping, FILE_MAP_READ, 0, 0); +#else file->contents = (char *) MapViewOfFile (file->mapping, FILE_MAP_READ, 0, 0, 0); +#endif if (unlikely (file->contents == nullptr)) goto fail; CloseHandle (fd); diff --git a/src/hb.hh b/src/hb.hh index 557ae6b3..631592de 100644 --- a/src/hb.hh +++ b/src/hb.hh @@ -237,7 +237,9 @@ struct _hb_alignof # undef _WIN32_WINNT # endif # ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 +# if !defined(WINAPI_FAMILY) || !(WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) +# define _WIN32_WINNT 0x0600 +# endif # endif # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN 1 commit b7f1bbc2f8b14a402fa9e42e88919dc0173373ce Author: Khaled Hosny <[email protected]> Date: Sat Sep 22 16:41:56 2018 +0200 [test] Fix printing subprocess error messages Decode the string as Python 3 returns bytes string, and also don’t assume that it ends with a new line. diff --git a/test/shaping/run-tests.py b/test/shaping/run-tests.py index 73b61c21..915536b9 100755 --- a/test/shaping/run-tests.py +++ b/test/shaping/run-tests.py @@ -9,7 +9,7 @@ def cmd(command): p = subprocess.Popen ( command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p.wait () - print (p.stderr.read (), end="") # file=sys.stderr + print (p.stderr.read ().decode ("utf-8").strip ()) # file=sys.stderr return p.stdout.read ().decode ("utf-8").strip (), p.returncode commit 403019482b0d7f17fbdb5def2be5f43e28bafcf3 Author: Ebrahim Byagowi <[email protected]> Date: Sat Sep 22 17:24:03 2018 +0330 Fix test-subset-* leak issues See also https://github.com/harfbuzz/harfbuzz/pull/1169 diff --git a/test/api/hb-subset-test.h b/test/api/hb-subset-test.h index afd553a0..0318fa7b 100644 --- a/test/api/hb-subset-test.h +++ b/test/api/hb-subset-test.h @@ -51,12 +51,18 @@ static inline hb_face_t * hb_subset_test_open_font (const char *font_path) { #if GLIB_CHECK_VERSION(2,37,2) - char* path = g_test_build_filename(G_TEST_DIST, font_path, NULL); + char* path = g_test_build_filename (G_TEST_DIST, font_path, NULL); #else - char* path = g_strdup(font_path); + char* path = g_strdup (font_path); #endif - return hb_face_create (hb_blob_create_from_file (path), 0); + hb_blob_t* blob = hb_blob_create_from_file (path); + hb_face_t* face = hb_face_create (blob, 0); + hb_blob_destroy (blob); + + g_free (path); + + return face; } static inline hb_subset_input_t * commit f6ebe1f4dc95a7c4b3a0af23086873a11867c1d9 Author: Ebrahim Byagowi <[email protected]> Date: Sat Sep 22 17:05:52 2018 +0330 Fix test-ot-math leak issue See also https://github.com/harfbuzz/harfbuzz/pull/1169 diff --git a/test/api/test-ot-math.c b/test/api/test-ot-math.c index d071c889..7f500157 100644 --- a/test/api/test-ot-math.c +++ b/test/api/test-ot-math.c @@ -100,10 +100,14 @@ test_has_data (void) hb_face = hb_face_get_empty (); hb_font = hb_font_create (hb_face); g_assert(!hb_ot_math_has_data (hb_face)); // MATH table not available + hb_font_destroy (hb_font); + hb_face_destroy (hb_face); hb_font = hb_font_get_empty (); hb_face = hb_font_get_face (hb_font); g_assert(!hb_ot_math_has_data (hb_face)); // MATH table not available + hb_font_destroy (hb_font); + hb_face_destroy (hb_face); cleanupFreeType(); } commit 669ac81ac52e9d559324db851a9ee46ef651e7b0 Author: Ebrahim Byagowi <[email protected]> Date: Sat Sep 22 16:49:23 2018 +0330 Fix test-set leak issue See also https://github.com/harfbuzz/harfbuzz/pull/1169 diff --git a/test/api/test-set.c b/test/api/test-set.c index 338a610c..eb2f22ec 100644 --- a/test/api/test-set.c +++ b/test/api/test-set.c @@ -262,6 +262,7 @@ test_set_algebra (void) hb_set_destroy (s); hb_set_destroy (o); + hb_set_destroy (o2); } static void commit ef9307fd2227bf0f750d8f7fafae466affc81454 Author: Ebrahim Byagowi <[email protected]> Date: Sat Sep 22 16:45:31 2018 +0330 Fix test-font leak issue See also https://github.com/harfbuzz/harfbuzz/pull/1169 diff --git a/test/api/test-font.c b/test/api/test-font.c index 527dfcdc..4a2393ec 100644 --- a/test/api/test-font.c +++ b/test/api/test-font.c @@ -361,6 +361,7 @@ test_fontfuncs_subclassing (void) hb_font_destroy (font3); + hb_font_destroy (font2); } _______________________________________________ HarfBuzz mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/harfbuzz
