[cairo-commit] 4 commits - src/cairo-scaled-font-subsets.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 18 21:33:03 UTC 2023


 src/cairo-scaled-font-subsets.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 35a38406f5df5698effc7139352ba1ae3a1130e0
Merge: e97cfe0b7 af83da70f
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Jul 18 21:33:01 2023 +0000

    Merge branch '5898791338508288' into 'master'
    
    Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56152
    
    See merge request cairo/cairo!493

commit af83da70f58f81eabb5eae020bc4cee3725090f4
Author: Alex <aleksandrosansan at gmail.com>
Date:   Tue Jul 18 12:04:59 2023 +0000

    Refix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56152 according to recommendations

diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index a205d956a..8a25a4612 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -430,7 +430,7 @@ _cairo_sub_font_glyph_map_to_unicode (cairo_sub_font_glyph_t *sub_font_glyph,
     if (utf8 != NULL && utf8_len != 0) {
 	if (sub_font_glyph->utf8 != NULL) {
 	    if (utf8_len == sub_font_glyph->utf8_len &&
-		memcmp (utf8, sub_font_glyph->utf8, utf8_len) == 0)
+		strncmp (utf8, sub_font_glyph->utf8, utf8_len) == 0)
 	    {
 		/* Requested utf8 mapping matches the existing mapping */
 		*is_mapped = TRUE;
@@ -611,11 +611,6 @@ _cairo_sub_font_map_glyph (cairo_sub_font_t	*sub_font,
                         free (ucs4);
                         return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 		    }
-                    if (strlen(font_utf8) != (size_t)text_utf8_len) {
-                        free (font_utf8);
-                        free (ucs4);
-                        return _cairo_error (CAIRO_STATUS_INVALID_SIZE);
-                    }
 		    font_utf8_len = text_utf8_len;
 		}
 		free (ucs4);
commit 90e38be99d422c7dd62e471295fb668565cff96a
Author: Alex <aleksandrosansan at gmail.com>
Date:   Mon Jul 10 19:01:32 2023 +0000

    Fix warning

diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index 9eaebcf25..a205d956a 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -611,7 +611,7 @@ _cairo_sub_font_map_glyph (cairo_sub_font_t	*sub_font,
                         free (ucs4);
                         return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 		    }
-                    if (strlen(font_utf8) != text_utf8_len) {
+                    if (strlen(font_utf8) != (size_t)text_utf8_len) {
                         free (font_utf8);
                         free (ucs4);
                         return _cairo_error (CAIRO_STATUS_INVALID_SIZE);
commit 2ecbfbce46c7a00f1ea635e10eb79962ca939c51
Author: Alex <aleksandrosansan at gmail.com>
Date:   Mon Jul 10 18:36:53 2023 +0000

    Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56152 memory read access because of incorrect size

diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index 2a9e8144c..9eaebcf25 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -611,6 +611,11 @@ _cairo_sub_font_map_glyph (cairo_sub_font_t	*sub_font,
                         free (ucs4);
                         return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 		    }
+                    if (strlen(font_utf8) != text_utf8_len) {
+                        free (font_utf8);
+                        free (ucs4);
+                        return _cairo_error (CAIRO_STATUS_INVALID_SIZE);
+                    }
 		    font_utf8_len = text_utf8_len;
 		}
 		free (ucs4);


More information about the cairo-commit mailing list