diff --git a/src/hb-icu.cc b/src/hb-icu.cc index aead6dda0..491c1c87f 100644 --- a/src/hb-icu.cc +++ b/src/hb-icu.cc @@ -255,13 +255,15 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, } else { /* If decomposed to more than two characters, take the last one, * and recompose the rest to get the first component. */ - U16_PREV_UNSAFE (normalized, len, *b); - UChar recomposed[20]; + U16_PREV_UNSAFE (normalized, len, *b); /* Changes len in-place. */ + UChar recomposed[18 * 2]; icu_err = U_ZERO_ERROR; len = unorm_normalize (normalized, len, UNORM_NFC, 0, recomposed, ARRAY_LENGTH (recomposed), &icu_err); if (U_FAILURE (icu_err)) return false; /* We expect that recomposed has exactly one character now. */ + if (unlikely (u_countChar32 (recomposed, len) != 1)) + return false; U16_GET_UNSAFE (recomposed, 0, *a); ret = true; } diff --git a/test/api/test-blob.c b/test/api/test-blob.c index 5fcb208c2..0e65e2f80 100644 --- a/test/api/test-blob.c +++ b/test/api/test-blob.c @@ -68,7 +68,7 @@ test_blob_empty (void) g_assert_cmpint (len, ==, 0); data_writable = hb_blob_get_data_writable (blob, NULL); - g_assert (data == NULL); + g_assert (data_writable == NULL); data_writable = hb_blob_get_data_writable (blob, &len); g_assert (data_writable == NULL); diff --git a/test/api/test-buffer.c b/test/api/test-buffer.c index ab818d036..1ddc3d84f 100644 --- a/test/api/test-buffer.c +++ b/test/api/test-buffer.c @@ -152,7 +152,7 @@ test_buffer_contents (fixture_t *fixture, gconstpointer user_data) } len = hb_buffer_get_length (b); - glyphs = hb_buffer_get_glyph_infos (b, NULL); /* test NULL */ + hb_buffer_get_glyph_infos (b, NULL); /* test NULL */ glyphs = hb_buffer_get_glyph_infos (b, &len2); g_assert_cmpint (len, ==, len2); g_assert_cmpint (len, ==, 5); @@ -264,7 +264,7 @@ test_buffer_positions (fixture_t *fixture, gconstpointer user_data) /* Without shaping, positions should all be zero */ len = hb_buffer_get_length (b); - positions = hb_buffer_get_glyph_positions (b, NULL); /* test NULL */ + hb_buffer_get_glyph_positions (b, NULL); /* test NULL */ positions = hb_buffer_get_glyph_positions (b, &len2); g_assert_cmpint (len, ==, len2); for (i = 0; i < len; i++) { diff --git a/util/helper-cairo.cc b/util/helper-cairo.cc index 0cdfd6350..35340d17e 100644 --- a/util/helper-cairo.cc +++ b/util/helper-cairo.cc @@ -416,7 +416,7 @@ helper_cairo_line_from_buffer (helper_cairo_line_t *l, hb_bool_t backward = HB_DIRECTION_IS_BACKWARD (hb_buffer_get_direction (buffer)); l->cluster_flags = backward ? CAIRO_TEXT_CLUSTER_FLAG_BACKWARD : (cairo_text_cluster_flags_t) 0; unsigned int cluster = 0; - const char *start = l->utf8, *end = start; + const char *start = l->utf8, *end; l->clusters[cluster].num_glyphs++; if (backward) { for (i = l->num_glyphs - 2; i >= 0; i--) {