mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2024-11-10 15:38:27 +01:00
Fix some Coverity-detected issues.
This commit is contained in:
parent
1168fd974f
commit
d5173d14da
@ -7,6 +7,7 @@ v1.0.0 (TBD)
|
|||||||
|
|
||||||
- Added `pdfioFileCreateOutput` API to support streaming output of PDF
|
- Added `pdfioFileCreateOutput` API to support streaming output of PDF
|
||||||
(Issue #21)
|
(Issue #21)
|
||||||
|
- Fixed some issues identified by a Coverity scan.
|
||||||
|
|
||||||
|
|
||||||
v1.0b1 (August 30, 2021)
|
v1.0b1 (August 30, 2021)
|
||||||
|
@ -568,7 +568,8 @@ _pdfioArrayRead(pdfio_file_t *pdf, // I - PDF file
|
|||||||
PDFIO_DEBUG("_pdfioArrayRead(pdf=%p, tb=%p)\n", pdf, tb);
|
PDFIO_DEBUG("_pdfioArrayRead(pdf=%p, tb=%p)\n", pdf, tb);
|
||||||
|
|
||||||
// Create an array...
|
// Create an array...
|
||||||
array = pdfioArrayCreate(pdf);
|
if ((array = pdfioArrayCreate(pdf)) == NULL)
|
||||||
|
return (NULL);
|
||||||
|
|
||||||
// Read until we get "]" to end the array...
|
// Read until we get "]" to end the array...
|
||||||
while (_pdfioTokenGet(tb, token, sizeof(token)))
|
while (_pdfioTokenGet(tb, token, sizeof(token)))
|
||||||
|
@ -2358,7 +2358,7 @@ copy_png(pdfio_dict_t *dict, // I - Dictionary
|
|||||||
PDFIO_DEBUG("copy_png: Adding %s ColorSpace value.\n", color_type == _PDFIO_PNG_TYPE_GRAY ? "CalGray" : "CalRGB");
|
PDFIO_DEBUG("copy_png: Adding %s ColorSpace value.\n", color_type == _PDFIO_PNG_TYPE_GRAY ? "CalGray" : "CalRGB");
|
||||||
|
|
||||||
if (wx != 0.0)
|
if (wx != 0.0)
|
||||||
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromPrimaries(dict->pdf, color_type == _PDFIO_PNG_TYPE_GRAY ? 1 : 3, gamma, wx, wy, rx, ry, bx, by, gx, gy));
|
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromPrimaries(dict->pdf, color_type == _PDFIO_PNG_TYPE_GRAY ? 1 : 3, gamma, wx, wy, rx, ry, gx, gy, bx, by));
|
||||||
else
|
else
|
||||||
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromStandard(dict->pdf, color_type == _PDFIO_PNG_TYPE_GRAY ? 1 : 3, PDFIO_CS_SRGB));
|
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromStandard(dict->pdf, color_type == _PDFIO_PNG_TYPE_GRAY ? 1 : 3, PDFIO_CS_SRGB));
|
||||||
}
|
}
|
||||||
|
@ -1388,7 +1388,11 @@ load_xref(pdfio_file_t *pdf, // I - PDF file
|
|||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_pdfioFileSeek(pdf, xref_offset + ptr + 3 - line, SEEK_SET);
|
if (_pdfioFileSeek(pdf, xref_offset + ptr + 3 - line, SEEK_SET) < 0)
|
||||||
|
{
|
||||||
|
_pdfioFileError(pdf, "Unable to seek to xref object %lu %u.", (unsigned long)number, (unsigned)generation);
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
|
||||||
PDFIO_DEBUG("load_xref: Loading object %lu %u.\n", (unsigned long)number, (unsigned)generation);
|
PDFIO_DEBUG("load_xref: Loading object %lu %u.\n", (unsigned long)number, (unsigned)generation);
|
||||||
|
|
||||||
|
@ -278,6 +278,8 @@ _pdfioValueRead(pdfio_file_t *pdf, // I - PDF file
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Date value...
|
// Date value...
|
||||||
|
memset(&dateval, 0, sizeof(dateval));
|
||||||
|
|
||||||
dateval.tm_year = (token[3] - '0') * 1000 + (token[4] - '0') * 100 + (token[5] - '0') * 10 + token[6] - '0' - 1900;
|
dateval.tm_year = (token[3] - '0') * 1000 + (token[4] - '0') * 100 + (token[5] - '0') * 10 + token[6] - '0' - 1900;
|
||||||
dateval.tm_mon = (token[7] - '0') * 10 + token[8] - '0' - 1;
|
dateval.tm_mon = (token[7] - '0') * 10 + token[8] - '0' - 1;
|
||||||
dateval.tm_mday = (token[9] - '0') * 10 + token[10] - '0';
|
dateval.tm_mday = (token[9] - '0') * 10 + token[10] - '0';
|
||||||
|
Loading…
Reference in New Issue
Block a user