aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2023-04-04 16:54:54 +0200
committerm-holger <m-holger@kubitscheck.org>2023-04-04 16:54:54 +0200
commit3f2ebf334b2d42b84243da589fe41df0e28cc2e8 (patch)
treedd9890b2baa3b2b0967206fc688c15f2a9a65c5f
parent230f1ab29039c30c5974d17ddcb0667ceedccf79 (diff)
downloadqpdf-3f2ebf334b2d42b84243da589fe41df0e28cc2e8.tar.zst
Fix bug in QPDF_Name::normalizeName introduced in #891
'#' was omitted from the list of chars that need to be escaped.
-rw-r--r--libqpdf/QPDF_Name.cc6
-rw-r--r--qpdf/qtest/qpdf/pound-in-name.pdf1
-rw-r--r--qpdf/qtest/qpdf/pound-in-name.qdf1
3 files changed, 5 insertions, 3 deletions
diff --git a/libqpdf/QPDF_Name.cc b/libqpdf/QPDF_Name.cc
index 3241ec1c..2fa697cf 100644
--- a/libqpdf/QPDF_Name.cc
+++ b/libqpdf/QPDF_Name.cc
@@ -38,9 +38,9 @@ QPDF_Name::normalizeName(std::string const& name)
// invalid #.
result += "#";
} else if (
- ch < 33 || ch == '/' || ch == '(' || ch == ')' || ch == '{' ||
- ch == '}' || ch == '<' || ch == '>' || ch == '[' || ch == ']' ||
- ch == '%' || ch > 126) {
+ ch < 33 || ch == '#' || ch == '/' || ch == '(' || ch == ')' ||
+ ch == '{' || ch == '}' || ch == '<' || ch == '>' || ch == '[' ||
+ ch == ']' || ch == '%' || ch > 126) {
result += QUtil::hex_encode_char(ch);
} else {
result += ch;
diff --git a/qpdf/qtest/qpdf/pound-in-name.pdf b/qpdf/qtest/qpdf/pound-in-name.pdf
index c19dfb24..dcaa4d44 100644
--- a/qpdf/qtest/qpdf/pound-in-name.pdf
+++ b/qpdf/qtest/qpdf/pound-in-name.pdf
@@ -81,6 +81,7 @@ trailer <<
/a#b [ 4 /##00## /Som#ething ]
/Som#ething (else)
>>
+ /#20#23#2f#28#29#7b#7d#3c#3e#5b#5d#25#21#7e#7f 42
>>
startxref
diff --git a/qpdf/qtest/qpdf/pound-in-name.qdf b/qpdf/qtest/qpdf/pound-in-name.qdf
index e6ecf5ab..67f57382 100644
--- a/qpdf/qtest/qpdf/pound-in-name.qdf
+++ b/qpdf/qtest/qpdf/pound-in-name.qdf
@@ -92,6 +92,7 @@ xref
0000000629 00000 n
0000000774 00000 n
trailer <<
+ /#20#23#2f#28#29#7b#7d#3c#3e#5b#5d#25!~#7f 42
/Other#20Tests <<
/## 1
/#20# 2