groff-commit
[Top][All Lists]
Advanced

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

[groff] 01/01: If input text contained string which could be interpreted


From: Deri James
Subject: [groff] 01/01: If input text contained string which could be interpreted as escaped octal (\ddd) a pdf viewer would interpret as an octal character. See bug at: https://savannah.gnu.org/bugs/?51568
Date: Tue, 25 Jul 2017 11:46:01 -0400 (EDT)

deri pushed a commit to branch master
in repository groff.

commit 67c3d46d452ce05082839920a8058091a8797583
Author: Deri James <address@hidden>
Date:   Tue Jul 25 16:43:54 2017 +0100

        If input text contained string which could be interpreted as
        escaped octal (\ddd) a pdf viewer would interpret as an octal
        character.  See bug at: https://savannah.gnu.org/bugs/?51568
    
        * src/devices/gropdf/gropdf: protect text which resembles \ddd
        by escaping with extra '\'.
---
 ChangeLog                    |  9 +++++++++
 src/devices/gropdf/gropdf.pl | 17 +++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 44645b9..caa5498 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-07-25  Deri James  <address@hidden>
+
+       If input text contained string which could be interpreted as
+       escaped octal (\ddd) a pdf viewer would interpret as an octal
+       character.  See bug at: https://savannah.gnu.org/bugs/?51568
+       
+       * src/devices/gropdf/gropdf: protect text which resembles \ddd
+       by escaping with extra '\'.
+       
 2017-07-12  Bertrand Garrigues <address@hidden>
 
        Use uchardet library in `preconv' to detect input file encoding
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index a3bba58..8f0a320 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -2946,6 +2946,7 @@ sub PutLine
     {
        if (scalar(@lin) == 1 and (!defined($lin[0]->[1]) or $lin[0]->[1] == 0))
        {
+           $lin[0]->[0]=~s/\\\d{1,3}/\\${&}/g;
            $stream.="($lin[0]->[0]) Tj\n";
        }
        else
@@ -2954,7 +2955,12 @@ sub PutLine
 
            foreach my $wd (@lin)
            {
-               $stream.="($wd->[0]) " if defined($wd->[0]);
+               if (defined($wd->[0]))
+               {
+                   $wd->[0]=~s/\\\d{1,3}/\\${&}/g;
+                   $stream.="($wd->[0]) ";
+               }
+               
                $stream.="$wd->[1] " if defined($wd->[1]) and $wd->[1] != 0;
            }
 
@@ -2965,6 +2971,7 @@ sub PutLine
     {
        if (scalar(@lin) == 1 and (!defined($lin[0]->[1]) or $lin[0]->[1] == 0))
        {
+           $lin[0]->[0]=~s/\\\d{1,3}/\\${&}/g;
            $stream.="0 Tw ($lin[0]->[0]) Tj\n";
        }
        else
@@ -2975,7 +2982,12 @@ sub PutLine
 
                foreach my $wd (@lin)
                {
-                   $stream.="($wd->[0]) " if defined($wd->[0]);
+                   if (defined($wd->[0]))
+                   {
+                       $wd->[0]=~s/\\\d{1,3}/\\${&}/g;
+                       $stream.="($wd->[0]) ";
+                   }
+                   
                    $stream.="$wd->[1] " if defined($wd->[1]) and $wd->[1] != 0;
                }
 
@@ -3014,6 +3026,7 @@ sub PutLine
                foreach my $wd (@lin)
                {
                    my $wwt=$wd->[1]||0;
+                   $wd->[0]=~s/\\\d{1,3}/\\${&}/g;
 
                    while ($wwt <= $wt+.1)
                    {



reply via email to

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