mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-08-29 07:12:02 +02:00
Save work on resolving PDF loading issues with random PDFs using different encryption methods and line endings.
This commit is contained in:
@@ -396,20 +396,27 @@ pdfioArrayGetBinary(
|
||||
size_t n, // I - Index
|
||||
size_t *length) // O - Length of string
|
||||
{
|
||||
if (!a || n >= a->num_values || a->values[n].type != PDFIO_VALTYPE_BINARY)
|
||||
if (!a || n >= a->num_values || (a->values[n].type != PDFIO_VALTYPE_BINARY && a->values[n].type != PDFIO_VALTYPE_STRING))
|
||||
{
|
||||
if (length)
|
||||
*length = 0;
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
else
|
||||
else if (a->values[n].type == PDFIO_VALTYPE_BINARY)
|
||||
{
|
||||
if (length)
|
||||
*length = a->values[n].value.binary.datalen;
|
||||
|
||||
return (a->values[n].value.binary.data);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (length)
|
||||
*length = strlen(a->values[n].value.string);
|
||||
|
||||
return ((unsigned char *)a->values[n].value.string);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user