groff-commit
[Top][All Lists]
Advanced

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

[groff] 01/01: Don't use inbuilt pdf parser on user supplied data.


From: Deri James
Subject: [groff] 01/01: Don't use inbuilt pdf parser on user supplied data.
Date: Fri, 11 Oct 2024 18:03:04 -0400 (EDT)

deri pushed a commit to branch master
in repository groff.

commit b25f02d7a779b3885101848cea7000aff2f5ab3f
Author: Deri James <deri@chuzzlewit.myzen.co.uk>
AuthorDate: Fri Oct 11 23:00:10 2024 +0100

    Don't use inbuilt pdf parser on user supplied data.
    
    * src/devices/gropdf/gropdf.pl: Another example of using it
    in an inappropriate situation.
---
 ChangeLog                    |  7 +++++++
 src/devices/gropdf/gropdf.pl | 11 +++--------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 18117793f..2a19840d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-10-11  Deri James  <deri@chuzzlewit.myzen.co.uk>
+
+       Don't use inbuilt pdf parser on user supplied data.
+
+       * src/devices/gropdf/gropdf.pl: Another example of using it
+       in an inappropriate situation.
+
 2024-10-10  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * tmac/doc.tmac (doc-enclose-string): Add warning.  mdoc input
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index d83f8e17b..a6f7b6fee 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -1460,15 +1460,10 @@ sub do_x
                $pdfmark=~s(\\\[u00(..)\])(chr(hex($1)))eg;
                $pdfmark=~s/\\n/\n/g;
 
-               if ($pdfmark=~m/(.+) \/DOCINFO\s*$/s)
+               if ($pdfmark=~m/\/(\w+) \((.+)\) \/DOCINFO\s*$/s)
                {
-                   my @xwds=split(/ /,"<< $1 >>");
-                   my $docinfo=ParsePDFValue(\@xwds);
-
-                   foreach my $k (sort keys %{$docinfo})
-                   {
-                       $info{$k}='('.utf16(substr($docinfo->{$k},1,-1)).')' if 
$k ne 'Producer';
-                   }
+                   my $k=$1;
+                   $info{$k}='('.utf16($2,1,-1).')' if $k ne 'Producer';
                }
                elsif ($pdfmark=~m/(.+) \/DOCVIEW\s*$/)
                {



reply via email to

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