[openssl] master update

Richard Levitte levitte at openssl.org
Wed May 26 13:16:01 UTC 2021


The branch master has been updated
       via  0e7e3b9b9d2d0a49097b4e224098036d3e6b8087 (commit)
      from  7c499c7da93561fd620338cc4f8691c1dbc9ee36 (commit)


- Log -----------------------------------------------------------------
commit 0e7e3b9b9d2d0a49097b4e224098036d3e6b8087
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue May 25 10:29:24 2021 +0200

    util/fix-doc-nits: Fix link detection in collectnames() to be kinder
    
    The way the links were parsed out of the contents caused a regexp
    recursion.  The easiest way to deal with it is to find all markup
    using $markup_re, and then parsing out the L markups and add them to
    the links array.
    
    Fixes #15449
    
    Reviewed-by: Paul Dale <pauli at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15450)

-----------------------------------------------------------------------

Summary of changes:
 util/find-doc-nits | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/util/find-doc-nits b/util/find-doc-nits
index c62307a9ce..7498ac6865 100755
--- a/util/find-doc-nits
+++ b/util/find-doc-nits
@@ -1000,16 +1000,27 @@ sub collectnames {
         }
     }
 
-    my @links =
-        $podinfo{contents} =~ /L<
-                              # if the link is of the form L<something|name(s)>,
-                              # then remove 'something'.  Note that 'something'
-                              # may contain POD codes as well...
-                              (?:(?:[^\|]|<[^>]*>)*\|)?
-                              # we're only interested in references that have
-                              # a one digit section number
-                              ([^\/>\(]+\(\d\))
-                             /gx;
+    my @links = ();
+    # Don't use this regexp directly on $podinfo{contents}, as it causes
+    # a regexp recursion, which fails on really big PODs.  Instead, use
+    # $markup_re to pick up general markup, and use this regexp to check
+    # that the markup that was found is indeed a link.
+    my $linkre = qr/L<
+                    # if the link is of the form L<something|name(s)>,
+                    # then remove 'something'.  Note that 'something'
+                    # may contain POD codes as well...
+                    (?:(?:[^\|]|<[^>]*>)*\|)?
+                    # we're only interested in references that have
+                    # a one digit section number
+                    ([^\/>\(]+\(\d\))
+                   /x;
+    while ( $podinfo{contents} =~ /$markup_re/msg ) {
+        my $x = $1;
+
+        if ($x =~ $linkre) {
+            push @links, $1;
+        }
+    }
     $link_map{$filename} = [ @links ];
 }
 


More information about the openssl-commits mailing list