mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-06 15:08:02 +02:00
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>
This commit is contained in:
parent
2cfd08664d
commit
53ee809ad9
1 changed files with 1 additions and 1 deletions
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue