groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 05/05: Hardening of pdf:href.opt\\$1 processing


From: Deri James
Subject: [groff] 05/05: Hardening of pdf:href.opt\\$1 processing
Date: Mon, 28 Aug 2023 13:50:08 -0400 (EDT)

deri pushed a commit to branch deri-gropdf-ng
in repository groff.

commit ec75f38cecd673c7959092d2c97bc4721ea0f4fa
Author: Deri James <deri@chuzzlewit.myzen.co.uk>
AuthorDate: Mon Aug 28 18:25:08 2023 +0100

    Hardening of pdf:href.opt\\$1 processing
    
    an.tmac sync changes to pdf.tmac
---
 tmac/an.tmac  |  4 +++-
 tmac/pdf.tmac | 45 ++++++++++++++++++++++++++++++++++++---------
 2 files changed, 39 insertions(+), 10 deletions(-)

diff --git a/tmac/an.tmac b/tmac/an.tmac
index 897b8bc27..6c6ed6de1 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -1192,7 +1192,9 @@ contains unsupported escape sequence
 .      I \\$1
 .    el \{\
 .      an*cln an*page-ref-nm \\$1_\\$2
-.      ie d pdf:look(\\*[an*page-ref-nm]) .pdfhref L -D \\*[an*page-ref-nm] -A 
"\\$3" -- \fI\\$1\fP(\\$2)
+.      ds an*page-ref-nm-hex \\*[an*page-ref-nm]
+.      stringhex an*page-ref-nm-hex
+.      ie d pdf:look(\\*[an*page-ref-nm-hex]) .pdfhref L -D 
\\*[an*page-ref-nm] -A "\\$3" -- \fI\\$1\fP(\\$2)
 .      el .IR \\$1 (\\$2)\\$3
 .    \}
 .  \}
diff --git a/tmac/pdf.tmac b/tmac/pdf.tmac
index ddfa5d4eb..1c4c8866a 100644
--- a/tmac/pdf.tmac
+++ b/tmac/pdf.tmac
@@ -184,10 +184,22 @@ am solely responsible for any bugs I may have introduced 
into this file.
 .   \"
 .      ds pdf:href-T
 .      ds pdf:hrefhex-T
-.      while dpdf:href.opt\\$1 \{\
-.         pdf:href.opt\\$1 \\$@
-.         shift \\n[pdf:href.argc]
+.      length pdf:l \\$1
+.      ds pdf:char1 \\$1
+.      substring pdf:char1 0 0
+.      if !'\\*[pdf:char1]'-' .nr pdf:l 99
+.      while (\\n[pdf:l]<4) \{\
+.         ie dpdf:href.opt\\$1 \{\
+.            pdf:href.opt\\$1 \\$@
+.            shift \\n[pdf:href.argc]
+.            length pdf:l \\$1
+.            if '\\$1'--' .break
+.            ds pdf:char1 \\$1
+.            substring pdf:char1 0 0
+.            if !'\\*[pdf:char1]'-' .nr pdf:l 99
 .         \}
+.         el .break
+.      \}
 .      rr pdf:href.argc
 .   \"
 .   \" If we found "--" to mark the end of the options, discard it
@@ -558,12 +570,18 @@ am solely responsible for any bugs I may have introduced 
into this file.
 .\" the "descriptive text" component of the argument list).
 .\"
 .length pdf:l \\$1
+.ds pdf:char1 \\$1
+.substring pdf:char1 0 0
+.if !'\\*[pdf:char1]'-' .nr pdf:l 99
 .while (\\n[pdf:l]<4) \{\
 .   ie dpdf:href.opt\\$1 \{\
 .      pdf:href.opt\\$1 \\$@
 .      shift \\n[pdf:href.argc]
 .      length pdf:l \\$1
 .      if '\\$1'--' .break
+.      ds pdf:char1 \\$1
+.      substring pdf:char1 0 0
+.      if !'\\*[pdf:char1]'-' .nr pdf:l 99
 .   \}
 .   el .break
 .\}
@@ -656,13 +674,22 @@ am solely responsible for any bugs I may have introduced 
into this file.
 .\" options -- anything which is not recognised is assumed to start
 .\" the "link text" component of the argument list).
 .\"
-.length l \\$1
-.if \\n[l]<3 \{\
-.while dpdf:href.opt\\$1 \{\
-.   pdf:href.opt\\$1 \\$@
-.   shift \\n[pdf:href.argc]
+.length pdf:l \\$1
+.ds pdf:char1 \\$1
+.substring pdf:char1 0 0
+.if !'\\*[pdf:char1]'-' .nr pdf:l 99
+.while (\\n[pdf:l]<4) \{\
+.   ie dpdf:href.opt\\$1 \{\
+.      pdf:href.opt\\$1 \\$@
+.      shift \\n[pdf:href.argc]
+.      length pdf:l \\$1
+.      if '\\.$1'--' .break
+.      ds pdf:char1 \\$1
+.      substring pdf:char1 0 0
+.      if !'\\*[pdf:char1]'-' .nr pdf:l 99
 .   \}
-\}
+.   el .break
+.\}
 .\"
 .\" If we found "--", to mark the end of the options, then we should
 .\" discard it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]