mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-10-26 16:13:29 +01:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user