gbranden pushed a commit to branch master
in repository groff.

commit d3886709d6bce2805368253bbbaf93e552f9837e
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Jun 14 09:38:29 2024 -0500

    [mm]: Validate `SP` macro argument.
    
    * contrib/mm/m.tmac (SP): Validate argument.  It must be numeric and
      can't be negative.
    * contrib/mm/groff_mm.7.man (Macros) <SP>: Document restrictions.
---
 contrib/mm/ChangeLog      | 6 ++++++
 contrib/mm/groff_mm.7.man | 7 ++++++-
 contrib/mm/m.tmac         | 6 +++++-
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index 7d2219c64..f89062b66 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,9 @@
+2024-06-14  G. Branden Robinson <[email protected]>
+
+       * m.tmac (SP): Validate argument.  It must be numeric and can't
+       be negative.
+       * groff_mm.7.man (Macros) <SP>: Document restrictions.
+
 2024-06-14  G. Branden Robinson <[email protected]>
 
        * m.tmac (VERBON): Check for font availability before switching.
diff --git a/contrib/mm/groff_mm.7.man b/contrib/mm/groff_mm.7.man
index 74817df0b..728e77967 100644
--- a/contrib/mm/groff_mm.7.man
+++ b/contrib/mm/groff_mm.7.man
@@ -3520,7 +3520,7 @@ at normal size.
 .TP
 .BR SP \~\c
 .RI [ distance ]
-Space vertically by
+Space downward by
 .I distance.
 .
 Multiple
@@ -3528,6 +3528,11 @@ Multiple
 calls in sequence produces only the largest of the specified
 .I distances.
 .
+Absolute motions with a prefixed
+.B |
+operator are accepted;
+negative ones are not.
+.
 .
 .IP
 .B SP
diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index 33ec848c0..13cf64878 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -497,7 +497,11 @@ in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
 .br
 .if !r line*lp\\n[.z] .nr line*lp\\n[.z] 0
 .if !r line*ac\\n[.z] .nr line*ac\\n[.z] 0
-.ie \\n[.$] .nr line*temp (v;\\$1)
+.ie \\n[.$] \{\
+.      if !\B'\\$1' .@error \\$0: parameter is not numeric; got '\\$1'
+.      if (\\$1 < 0) .@error \\$0: negative motion '\\$1' not supported
+.      nr line*temp (v;\\$1)
+.\}
 .el .nr line*temp 1v
 .\"
 .ie \\n[line*lp\\n[.z]]=\\n[.d] \{\

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to