groff-commit
[Top][All Lists]
Advanced

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

[groff] 113/127: [tbl]: Diagnose premature EOF in more places.


From: G. Branden Robinson
Subject: [groff] 113/127: [tbl]: Diagnose premature EOF in more places.
Date: Mon, 10 Jul 2023 04:31:06 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 4e26290a85040da43fe3b1e379a87a3689e10c58
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri May 19 03:48:16 2023 -0500

    [tbl]: Diagnose premature EOF in more places.
    
    * src/preproc/tbl/main.cpp (process_format): Check for EOF after eating
      spaces and tabs when processing [pPvVwW] column modifiers, and emit an
      appropriate error diagnostic.  This was already being done for [fFmM].
---
 ChangeLog                |  7 +++++++
 src/preproc/tbl/main.cpp | 13 +++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index f2d4759e9..43dcb3e00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-05-19  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/preproc/tbl/main.cpp (process_format): Check for EOF after
+       eating spaces and tabs when processing [pPvVwW] column
+       modifiers, and emit an appropriate error diagnostic.  This was
+       already being done for [fFmM].
+
 2023-05-19  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/preproc/tbl/main.cpp (process_format): Accept (and
diff --git a/src/preproc/tbl/main.cpp b/src/preproc/tbl/main.cpp
index b02baaeec..8ebb04b65 100644
--- a/src/preproc/tbl/main.cpp
+++ b/src/preproc/tbl/main.cpp
@@ -995,6 +995,10 @@ format *process_format(table_input &in, options *opt,
          do {
            c = in.get();
          } while (c == ' ' || c == '\t');
+         if (c == EOF) {
+           error("'p' column modifier missing type size parameter");
+           break;
+         }
          if (c == '+' || c == '-') {
            ps.inc = (c == '+' ? 1 : -1);
            c = in.get();
@@ -1040,6 +1044,11 @@ format *process_format(table_input &in, options *opt,
          do {
            c = in.get();
          } while (c == ' ' || c == '\t');
+         if (c == EOF) {
+           error("'v' column modifier missing vertical spacing"
+                 " parameter");
+           break;
+         }
          if (c == '+' || c == '-') {
            vs.inc = (c == '+' ? 1 : -1);
            c = in.get();
@@ -1071,6 +1080,10 @@ format *process_format(table_input &in, options *opt,
        do {
          c = in.get();
        } while (c == ' ' || c == '\t');
+       if (c == EOF) {
+         error("'w' column modifier missing width parameter");
+         break;
+       }
        if (c == '(') {
          list->width = "";
          c = in.get();



reply via email to

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