Allow trailing . in numeric token (fixes #165)

This commit is contained in:
Jay Berkenbilt 2018-01-13 20:05:13 -05:00
parent 6299c64cf3
commit 791e0db762
5 changed files with 18 additions and 12 deletions

View File

@ -1,10 +1,13 @@
2018-01-13 Jay Berkenbilt <ejb@ql.org>
* Fix lexical error: the PDF specification allows floating point
numbers to end with ".". Fixes #165.
* Fix link order in the build to avoid conflicts when building
from source while an older version of qpdf is installed.
from source while an older version of qpdf is installed. Fixes #158.
* Add support for TIFF predictor for LZW and Flate streams. Now
all predictor functions are supported.
all predictor functions are supported. Fixes #171.
2017-12-25 Jay Berkenbilt <ejb@ql.org>

View File

@ -558,7 +558,7 @@ QUtil::is_digit(char ch)
bool
QUtil::is_number(char const* p)
{
// ^[\+\-]?(\.\d+|\d+(\.\d+)?)$
// ^[\+\-]?(\.\d*|\d+(\.\d*)?)$
if (! *p)
{
return false;
@ -578,11 +578,6 @@ QUtil::is_number(char const* p)
// only one dot
return false;
}
if (! *(p+1))
{
// dot can't be last
return false;
}
found_dot = true;
}
else if (QUtil::is_digit(*p))

View File

@ -1,8 +1,12 @@
/QTest is direct and has type array (8)
/QTest is an array with 3 items
/QTest is an array with 7 items
item 0 is direct
item 1 is direct
item 2 is indirect
unparse: [ 1 (2) 8 0 R ]
unparseResolved: [ 1 (2) 8 0 R ]
item 3 is direct
item 4 is direct
item 5 is direct
item 6 is direct
unparse: [ 1 (2) 8 0 R 0.0 -0.0 0. -0. ]
unparseResolved: [ 1 (2) 8 0 R 0.0 -0.0 0. -0. ]
test 1 done

View File

@ -73,7 +73,7 @@ xref
trailer <<
/Size 7
/Root 1 0 R
/QTest [1 (2) 8 0 R]
/QTest [1 (2) 8 0 R 0.0 -0.0 0. -0.]
>>
startxref
556

View File

@ -96,6 +96,10 @@ trailer <<
1
(2)
null
0.0
-0.0
0.
-0.
]
/Root 1 0 R
/Size 8