block usage of incompatible operators and functions, for example the pdfioFileCreateFontObjFromBase function, the use of transparency in pdfioFileCreateImageObjFrom..., and so forth.

This commit is contained in:
vididvidid
2025-10-01 08:17:17 +00:00
parent 1325c9cd61
commit f417a25121

View File

@@ -1700,6 +1700,11 @@ pdfioFileCreateFontObjFromBase(
pdfio_dict_t *dict; // Font dictionary
pdfio_obj_t *obj; // Font object
if (pdf && pdf->pdfa != _PDFIO_PDFA_NONE)
{
_pdfioFileError(pdf, "Base fonts are not allowed in PDF/A files; use pdfioFileCreateFontObjFromFile to embed a font.");
return (NULL);
}
if ((dict = pdfioDictCreate(pdf)) == NULL)
return (NULL);
@@ -2064,6 +2069,12 @@ pdfioFileCreateImageObjFromData(
};
if (pdf && (pdf->pdfa == _PDFIO_PDFA_1A || pdf->pdfa == _PDFIO_PDFA_1B) && alpha)
{
_pdfioFileError(pdf, "Images with transparency (alpha channels) are not allowed in PDF/A-1 files.");
return (NULL);
}
// Range check input...
if (!pdf || !data || !width || !height || num_colors < 1 || num_colors == 2 || num_colors > 4)
return (NULL);
@@ -2730,6 +2741,12 @@ copy_png(pdfio_dict_t *dict, // I - Dictionary
depth = png_get_bit_depth(pp, info);
color_type = png_get_color_type(pp, info);
if ((dict->pdf->pdfa == _PDFIO_PDFA_1A || dict->pdf->pdfa == _PDFIO_PDFA_1B) && (color_type & PNG_COLOR_MASK_ALPHA))
{
_pdfioFileError(dict->pdf, "PNG images with transparency (alpha channels) are not allowed in PDF/A-1 files.");
goto finish_png;
}
if (color_type & PNG_COLOR_MASK_PALETTE)
num_colors = 1;
else if (color_type & PNG_COLOR_MASK_COLOR)