ParseC.pm: gracefully handle DOS-style end-of-line in source files
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Tue, 15 Nov 2022 15:33:21 +0000 (16:33 +0100)
committerDr. David von Oheimb <dev@ddvo.net>
Fri, 18 Nov 2022 06:50:35 +0000 (07:50 +0100)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/19686)

(cherry picked from commit c507db9678f50482df5f6c58e42572fe6fe3007c)

util/perl/OpenSSL/ParseC.pm

index e3cfe07827631816ced946a01216e6e0bbf4e471..f98dd0e25e3b8bb02927746577001a3d626d49cd 100644 (file)
@@ -822,7 +822,7 @@ sub parse {
         # We use ¦undef¦ as a marker for a new line from the file.
         # Since we convert one line to several and unshift that into @lines,
         # that's the only safe way we have to track the original lines
-        my @lines = map { ( undef, $_ ) } split $/, $line;
+        my @lines = map { ( undef, $_ ) } split m|\R|, $line;
 
         # Remember that extra # we added above?  Now we remove it
         pop @lines;