mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-01-26 22:52:53 +01:00
Fix validation of date/time values (Issue #83)
This commit is contained in:
parent
53967552df
commit
b872df5a1e
@ -14,6 +14,7 @@ v1.4.0 - YYYY-MM-DD
|
||||
with `pdfioFileCreateFontObjFromBase` (Issue #84)
|
||||
- Fixed reading of PDF files whose trailer is missing a newline (Issue #80)
|
||||
- Fixed builds with some versions of VC++ (Issue #81)
|
||||
- Fixed validation of date/time values (Issue #83)
|
||||
|
||||
|
||||
v1.3.2 - 2024-08-15
|
||||
|
@ -755,6 +755,8 @@ get_date_time(const char *s) // I - PDF date/time value
|
||||
int offset; // Date offset
|
||||
|
||||
|
||||
PDFIO_DEBUG("get_date_time(s=\"%s\")\n", s);
|
||||
|
||||
// Possible date value of the form:
|
||||
//
|
||||
// (D:YYYYMMDDhhmmssZ)
|
||||
@ -772,10 +774,12 @@ get_date_time(const char *s) // I - PDF date/time value
|
||||
{
|
||||
if (s[i] == 'Z')
|
||||
{
|
||||
// UTC...
|
||||
i ++;
|
||||
}
|
||||
else if (s[i] == '-' || s[i] == '+')
|
||||
{
|
||||
// Timezone offset from UTC...
|
||||
if (isdigit(s[i + 1] & 255) && isdigit(s[i + 2] & 255) && s[i + 3] == '\'' && isdigit(s[i + 4] & 255) && isdigit(s[i + 5] & 255))
|
||||
{
|
||||
i += 6;
|
||||
@ -783,6 +787,11 @@ get_date_time(const char *s) // I - PDF date/time value
|
||||
i ++;
|
||||
}
|
||||
}
|
||||
else if (!s[i])
|
||||
{
|
||||
// Missing zone info, invalid date string...
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
if (s[i])
|
||||
|
Loading…
x
Reference in New Issue
Block a user