[cairo-commit] 2 commits - src/cairo-pdf-surface.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 28 04:50:01 UTC 2022


 src/cairo-pdf-surface.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b13fb85982dc9411637119f6b2418903ad3e7b37
Merge: 2b862f632 53ee809ad
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Wed Dec 28 04:49:59 2022 +0000

    Merge branch 'negative-version-values' into 'master'
    
    cairo_pdf_version_to_string: Check for negative values
    
    Closes #590
    
    See merge request cairo/cairo!358

commit 53ee809ad9fde2d70d71ed892b47a16bcb1ea494
Author: Uli Schlachter <psychon at znc.in>
Date:   Fri Sep 16 07:47:18 2022 +0200

    cairo_pdf_version_to_string: Check for negative values
    
    Before this commit, cairo_pdf_version_to_string() would return the
    result of an out-of-bounds array access when called with a negative
    value. This commit adds a check against this.
    
    No unit test added since there are no tests for
    cairo_pdf_version_to_string() that I could easily add such a test to.
    
    Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/590
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 9b2b93252..dcecfb23a 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -779,7 +779,7 @@ cairo_pdf_get_versions (cairo_pdf_version_t const	**versions,
 const char *
 cairo_pdf_version_to_string (cairo_pdf_version_t version)
 {
-    if (version >= CAIRO_PDF_VERSION_LAST)
+    if (version < 0 || version >= CAIRO_PDF_VERSION_LAST)
 	return NULL;
 
     return _cairo_pdf_version_strings[version];


More information about the cairo-commit mailing list