bug-groff
[Top][All Lists]
Advanced

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

[bug #54538] [PATCH] hdmisc.tmac-u: macro t*index: Fix the end value of


From: Bjarni Ingi Gislason
Subject: [bug #54538] [PATCH] hdmisc.tmac-u: macro t*index: Fix the end value of a while loop
Date: Sun, 19 Aug 2018 15:44:33 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

URL:
  <http://savannah.gnu.org/bugs/?54538>

                 Summary: [PATCH] hdmisc.tmac-u: macro t*index: Fix the end
value of a while  loop
                 Project: GNU troff
            Submitted by: bjarniig
            Submitted on: Sun 19 Aug 2018 07:44:32 PM UTC
                Category: Macro - others
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:


>From cfb9555eaf69442a682b4e8f02b580e81c0d080d Mon Sep 17 00:00:00 2001
From: Bjarni Ingi Gislason <address@hidden>
Date: Sun, 19 Aug 2018 19:31:29 +0000
Subject: [PATCH] hdmisc.tmac-u: macro t*index: Fix the end value of a while
 loop

  Check if the second string is longer than the first one.

  The end value for the comparison of the strings is too large.

Signed-off-by: Bjarni Ingi Gislason <address@hidden>
---
 contrib/hdtbl/hdmisc.tmac-u | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/contrib/hdtbl/hdmisc.tmac-u b/contrib/hdtbl/hdmisc.tmac-u
index 33111eb5..b001561f 100644
--- a/contrib/hdtbl/hdmisc.tmac-u
+++ b/contrib/hdtbl/hdmisc.tmac-u
@@ -158,7 +158,12 @@ along with this program.  If not, see
<http://www.gnu.org/licenses/>.
 .  length $2 \\$2
 .  nr * 0-1 1
 .
-.  while (\\n+[*] < \\n[**]) \{\
+.  if \\n[$2]>\\n[**] \{\
+.    nr t*index 0
+.    return
+.  \}
+.
+.  while (\\n+[*] < (\\n[**]-\\n[$2]) ) \{\
 .    ds * \\$1\"
 .    substring * \\n[*] (\\n[*] + \\n[$2] - 1)
 .    \" The surrounding \? escapes emulate string comparison.
@@ -166,7 +171,7 @@ along with this program.  If not, see
<http://www.gnu.org/licenses/>.
 .      break
 .  \}
 .
-.  ie (\\n[*] == \\n[**]) \
+.  ie (\\n[*] == (\\n[**]-\\n[$2]) ) \
 .    nr t*index 0
 .  el \
 .    nr t*index (\\n[*] + 1)
-- 
2.18.0






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54538>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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