mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-04-19 23:16:48 +02:00
Discard duplication key/value pairs in dictionaries with a warning message (Issue #118)
This commit is contained in:
parent
d7eb1fc540
commit
49efd97cab
@ -6,6 +6,8 @@ v1.5.2 - YYYY-MM-DD
|
|||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
- Updated maximum allowed PDF string size to 64k (Issue #117)
|
- Updated maximum allowed PDF string size to 64k (Issue #117)
|
||||||
|
- Updated dictionary reading code to discard duplicate key/value pairs with a
|
||||||
|
warning message (Issue #118)
|
||||||
- Fixed form detection in `pdfioinfo` example code (Issue #114)
|
- Fixed form detection in `pdfioinfo` example code (Issue #114)
|
||||||
- Fixed parsing of certain date/time values (Issue #115)
|
- Fixed parsing of certain date/time values (Issue #115)
|
||||||
- Fixed support for empty name values (Issue #116)
|
- Fixed support for empty name values (Issue #116)
|
||||||
|
16
pdfio-dict.c
16
pdfio-dict.c
@ -737,11 +737,6 @@ _pdfioDictRead(pdfio_file_t *pdf, // I - PDF file
|
|||||||
_pdfioFileError(pdf, "Invalid dictionary contents.");
|
_pdfioFileError(pdf, "Invalid dictionary contents.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (_pdfioDictGetValue(dict, key + 1))
|
|
||||||
{
|
|
||||||
_pdfioFileError(pdf, "Duplicate dictionary key '%s'.", key + 1);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then get the next value...
|
// Then get the next value...
|
||||||
PDFIO_DEBUG("_pdfioDictRead: Reading value for '%s'.\n", key + 1);
|
PDFIO_DEBUG("_pdfioDictRead: Reading value for '%s'.\n", key + 1);
|
||||||
@ -751,8 +746,15 @@ _pdfioDictRead(pdfio_file_t *pdf, // I - PDF file
|
|||||||
_pdfioFileError(pdf, "Missing value for dictionary key '%s'.", key + 1);
|
_pdfioFileError(pdf, "Missing value for dictionary key '%s'.", key + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if (_pdfioDictGetValue(dict, key + 1))
|
||||||
if (!_pdfioDictSetValue(dict, pdfioStringCreate(pdf, key + 1), &value))
|
{
|
||||||
|
// Issue 118: Discard duplicate key/value pairs, in the future this will
|
||||||
|
// be a warning message...
|
||||||
|
_pdfioFileError(pdf, "WARNING: Discarding value for duplicate dictionary key '%s'.", key + 1);
|
||||||
|
_pdfioValueDelete(&value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (!_pdfioDictSetValue(dict, pdfioStringCreate(pdf, key + 1), &value))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
PDFIO_DEBUG("_pdfioDictRead: Set %s.\n", key);
|
PDFIO_DEBUG("_pdfioDictRead: Set %s.\n", key);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user