diff options
author | Uli Schlachter <psychon@znc.in> | 2022-09-16 07:47:18 +0200 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2022-09-16 07:47:18 +0200 |
commit | 53ee809ad9fde2d70d71ed892b47a16bcb1ea494 (patch) | |
tree | 20d084a6b874a3171b971d73a33ebcfc18a71150 /src/cairo-pdf-surface.c | |
parent | 2cfd08664d080ff22e357a5feeca9bc29ec1823c (diff) | |
download | cairo-53ee809ad9fde2d70d71ed892b47a16bcb1ea494.tar.gz |
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@znc.in>
Diffstat (limited to 'src/cairo-pdf-surface.c')
-rw-r--r-- | src/cairo-pdf-surface.c | 2 |
1 files changed, 1 insertions, 1 deletions
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]; |