Commit 7e77af3583c76b0af4c4cfa2873e1ca2810d484a

Authored by Jay Berkenbilt
Committed by GitHub
2 parents 230f1ab2 3f2ebf33

Merge pull request #941 from m-holger/norm

Fix bug in QPDF_Name::normalizeName introduced in #891
libqpdf/QPDF_Name.cc
@@ -38,9 +38,9 @@ QPDF_Name::normalizeName(std::string const& name) @@ -38,9 +38,9 @@ QPDF_Name::normalizeName(std::string const& name)
38 // invalid #. 38 // invalid #.
39 result += "#"; 39 result += "#";
40 } else if ( 40 } else if (
41 - ch < 33 || ch == '/' || ch == '(' || ch == ')' || ch == '{' ||  
42 - ch == '}' || ch == '<' || ch == '>' || ch == '[' || ch == ']' ||  
43 - ch == '%' || ch > 126) { 41 + ch < 33 || ch == '#' || ch == '/' || ch == '(' || ch == ')' ||
  42 + ch == '{' || ch == '}' || ch == '<' || ch == '>' || ch == '[' ||
  43 + ch == ']' || ch == '%' || ch > 126) {
44 result += QUtil::hex_encode_char(ch); 44 result += QUtil::hex_encode_char(ch);
45 } else { 45 } else {
46 result += ch; 46 result += ch;
qpdf/qtest/qpdf/pound-in-name.pdf
@@ -81,6 +81,7 @@ trailer &lt;&lt; @@ -81,6 +81,7 @@ trailer &lt;&lt;
81 /a#b [ 4 /##00## /Som#ething ] 81 /a#b [ 4 /##00## /Som#ething ]
82 /Som#ething (else) 82 /Som#ething (else)
83 >> 83 >>
  84 + /#20#23#2f#28#29#7b#7d#3c#3e#5b#5d#25#21#7e#7f 42
84 >> 85 >>
85 86
86 startxref 87 startxref
qpdf/qtest/qpdf/pound-in-name.qdf
@@ -92,6 +92,7 @@ xref @@ -92,6 +92,7 @@ xref
92 0000000629 00000 n 92 0000000629 00000 n
93 0000000774 00000 n 93 0000000774 00000 n
94 trailer << 94 trailer <<
  95 + /#20#23#2f#28#29#7b#7d#3c#3e#5b#5d#25!~#7f 42
95 /Other#20Tests << 96 /Other#20Tests <<
96 /## 1 97 /## 1
97 /#20# 2 98 /#20# 2