Commit 791e0db7627e57d81076606e63786383f80219a3

Authored by Jay Berkenbilt
1 parent 6299c64c

Allow trailing . in numeric token (fixes #165)

ChangeLog
1 2018-01-13 Jay Berkenbilt <ejb@ql.org> 1 2018-01-13 Jay Berkenbilt <ejb@ql.org>
2 2
  3 + * Fix lexical error: the PDF specification allows floating point
  4 + numbers to end with ".". Fixes #165.
  5 +
3 * Fix link order in the build to avoid conflicts when building 6 * Fix link order in the build to avoid conflicts when building
4 - from source while an older version of qpdf is installed. 7 + from source while an older version of qpdf is installed. Fixes #158.
5 8
6 * Add support for TIFF predictor for LZW and Flate streams. Now 9 * Add support for TIFF predictor for LZW and Flate streams. Now
7 - all predictor functions are supported. 10 + all predictor functions are supported. Fixes #171.
8 11
9 2017-12-25 Jay Berkenbilt <ejb@ql.org> 12 2017-12-25 Jay Berkenbilt <ejb@ql.org>
10 13
libqpdf/QUtil.cc
@@ -558,7 +558,7 @@ QUtil::is_digit(char ch) @@ -558,7 +558,7 @@ QUtil::is_digit(char ch)
558 bool 558 bool
559 QUtil::is_number(char const* p) 559 QUtil::is_number(char const* p)
560 { 560 {
561 - // ^[\+\-]?(\.\d+|\d+(\.\d+)?)$ 561 + // ^[\+\-]?(\.\d*|\d+(\.\d*)?)$
562 if (! *p) 562 if (! *p)
563 { 563 {
564 return false; 564 return false;
@@ -578,11 +578,6 @@ QUtil::is_number(char const* p) @@ -578,11 +578,6 @@ QUtil::is_number(char const* p)
578 // only one dot 578 // only one dot
579 return false; 579 return false;
580 } 580 }
581 - if (! *(p+1))  
582 - {  
583 - // dot can't be last  
584 - return false;  
585 - }  
586 found_dot = true; 581 found_dot = true;
587 } 582 }
588 else if (QUtil::is_digit(*p)) 583 else if (QUtil::is_digit(*p))
qpdf/qtest/qpdf/good10.out
1 /QTest is direct and has type array (8) 1 /QTest is direct and has type array (8)
2 -/QTest is an array with 3 items 2 +/QTest is an array with 7 items
3 item 0 is direct 3 item 0 is direct
4 item 1 is direct 4 item 1 is direct
5 item 2 is indirect 5 item 2 is indirect
6 -unparse: [ 1 (2) 8 0 R ]  
7 -unparseResolved: [ 1 (2) 8 0 R ] 6 + item 3 is direct
  7 + item 4 is direct
  8 + item 5 is direct
  9 + item 6 is direct
  10 +unparse: [ 1 (2) 8 0 R 0.0 -0.0 0. -0. ]
  11 +unparseResolved: [ 1 (2) 8 0 R 0.0 -0.0 0. -0. ]
8 test 1 done 12 test 1 done
qpdf/qtest/qpdf/good10.pdf
@@ -73,7 +73,7 @@ xref @@ -73,7 +73,7 @@ xref
73 trailer << 73 trailer <<
74 /Size 7 74 /Size 7
75 /Root 1 0 R 75 /Root 1 0 R
76 - /QTest [1 (2) 8 0 R] 76 + /QTest [1 (2) 8 0 R 0.0 -0.0 0. -0.]
77 >> 77 >>
78 startxref 78 startxref
79 556 79 556
qpdf/qtest/qpdf/good10.qdf
@@ -96,6 +96,10 @@ trailer &lt;&lt; @@ -96,6 +96,10 @@ trailer &lt;&lt;
96 1 96 1
97 (2) 97 (2)
98 null 98 null
  99 + 0.0
  100 + -0.0
  101 + 0.
  102 + -0.
99 ] 103 ]
100 /Root 1 0 R 104 /Root 1 0 R
101 /Size 8 105 /Size 8