Add input checking to pdfioFileCreateFontObjFromBase.

This commit is contained in:
Michael R Sweet
2025-10-21 11:29:41 -04:00
parent 8459d97ff3
commit b6008bae76
2 changed files with 18 additions and 1 deletions

View File

@@ -2,6 +2,12 @@ Changes in PDFio
================
v1.6.1 - YYYY-MM-DD
-------------------
- Added missing input checking to `pdfioFileCreateFontObjFromBase` function.
v1.6.0 - 2025-10-06
-------------------

View File

@@ -1712,12 +1712,23 @@ pdfioFileCreateFontObjFromBase(
pdfio_obj_t *obj; // Font object
if (pdf && pdf->profile >= _PDFIO_PROFILE_PDFA_1A && pdf->profile <= _PDFIO_PROFILE_PDFA_4)
// Range check input...
if (!pdf)
return (NULL);
if (!name)
{
_pdfioFileError(pdf, "No base font name specified.");
return (NULL);
}
if (pdf->profile >= _PDFIO_PROFILE_PDFA_1A && pdf->profile <= _PDFIO_PROFILE_PDFA_4)
{
_pdfioFileError(pdf, "Base fonts are not allowed in PDF/A files; use pdfioFileCreateFontObjFromFile to embed a font.");
return (NULL);
}
// Create a base font object...
if ((dict = pdfioDictCreate(pdf)) == NULL)
return (NULL);