groff-commit
[Top][All Lists]
Advanced

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

[groff] 22/38: [libdriver]: Lethalize use of '[hHvH]' before 'p'.


From: G. Branden Robinson
Subject: [groff] 22/38: [libdriver]: Lethalize use of '[hHvH]' before 'p'.
Date: Mon, 3 Oct 2022 01:42:58 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit dd6b60c1b456bb6e63165966998f8479956e4d05
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Sep 29 08:36:16 2022 -0500

    [libdriver]: Lethalize use of '[hHvH]' before 'p'.
    
    * src/libs/libdriver/input.cpp (do_file): Make use of positioning
      commands before the first page is started fatal errors; they suggest
      ill-formed input.  The 'p' command clobbers the vertical position
      anyway.  (See https://bugs.debian.org/421437 for discussion.)
---
 ChangeLog                    |  8 ++++++++
 src/libs/libdriver/input.cpp | 18 ++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1419cf493..39be03513 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-09-29  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/libs/libdriver/input.cpp (do_file): Make use of
+       positioning commands before the first page is started fatal
+       errors; they suggest ill-formed input.  The 'p' command
+       clobbers the vertical position anyway.  (See
+       https://bugs.debian.org/421437 for discussion.)
+
 2022-09-29  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/pdf.tmac: Add inclusion guard; if a `pdfmark` macro is
diff --git a/src/libs/libdriver/input.cpp b/src/libs/libdriver/input.cpp
index 45f273d44..2d99eaeb2 100644
--- a/src/libs/libdriver/input.cpp
+++ b/src/libs/libdriver/input.cpp
@@ -1,7 +1,3 @@
-// -*- C++ -*-
-
-// <groff_src_dir>/src/libs/libdriver/input.cpp
-
 /* Copyright (C) 1989-2020 Free Software Foundation, Inc.
 
    Written by James Clark (jjc@jclark.com)
@@ -1735,9 +1731,13 @@ do_file(const char *filename)
        break;
       }
     case 'h':                  // h: relative horizontal move
+      if (npages <= 0)
+       fatal_command(command);
       current_env->hpos += (EnvInt) get_integer_arg();
       break;
     case 'H':                  // H: absolute horizontal positioning
+      if (npages <= 0)
+       fatal_command(command);
       current_env->hpos = (EnvInt) get_integer_arg();
       break;
     case 'm':                  // m: glyph color
@@ -1801,9 +1801,13 @@ do_file(const char *filename)
        break;
       }
     case 'v':                  // v: relative vertical move
+      if (npages <= 0)
+       fatal_command(command);
       current_env->vpos += (EnvInt) get_integer_arg();
       break;
     case 'V':                  // V: absolute vertical positioning
+      if (npages <= 0)
+       fatal_command(command);
       current_env->vpos = (EnvInt) get_integer_arg();
       break;
     case 'w':                  // w: inform about paddable space
@@ -1829,3 +1833,9 @@ do_file(const char *filename)
     warning("no final 'x stop' command");
   delete_current_env();
 }
+
+// Local Variables:
+// fill-column: 72
+// mode: C++
+// End:
+// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:



reply via email to

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