texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/Unicode.pm (check_unicode_po


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/Unicode.pm (check_unicode_point_conversion): in case encoding is not attempted, still use an eval to catch invalid argument to hex().
Date: Sat, 29 Jul 2023 04:26:15 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new b7fb8204a6 * tp/Texinfo/Convert/Unicode.pm 
(check_unicode_point_conversion): in case encoding is not attempted, still use 
an eval to catch invalid argument to hex().
b7fb8204a6 is described below

commit b7fb8204a6be413f3faed3abd5290d36549b4ede
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jul 29 10:26:04 2023 +0200

    * tp/Texinfo/Convert/Unicode.pm (check_unicode_point_conversion): in
    case encoding is not attempted, still use an eval to catch invalid
    argument to hex().
---
 ChangeLog                     |  6 ++++++
 tp/Texinfo/Convert/Unicode.pm | 18 +++++++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 26715d421c..be15fc707a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-07-29  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/Unicode.pm (check_unicode_point_conversion): in
+       case encoding is not attempted, still use an eval to catch invalid
+       argument to hex().
+
 2023-07-29  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/Unicode.pm (check_unicode_point_conversion): with
diff --git a/tp/Texinfo/Convert/Unicode.pm b/tp/Texinfo/Convert/Unicode.pm
index 83812ca79e..bf39e3439e 100644
--- a/tp/Texinfo/Convert/Unicode.pm
+++ b/tp/Texinfo/Convert/Unicode.pm
@@ -1614,10 +1614,22 @@ sub check_unicode_point_conversion($;$)
   # as a compiler bug, but it is unclear.  This does not happen with the
   # lax conversion to utf8, but we prefer to use a strict conversion.
   #
-  # To avoid outputting a warning, we do not even try the eval for perls
-  # in the 5.10.0 5.13.8 range
+  # To avoid outputting a warning, we do not even try to encode the string
+  # in the 5.10.0 5.13.8 range.
+  #
+  # We still use an eval to catch $arg that are illegal for hex
   if ($] >= 5.010 and $] <= 5.013008) {
-    if (hex($arg) > 0x10FFFF) {
+    eval {
+      use warnings FATAL => qw(all);
+      my $var;
+      if (hex($arg) > 0x10FFFF) {
+        $var = 1;
+      }
+    };
+    if ($@) {
+      warn "(hex($arg) eval failed: $@\n" if ($output_debug);
+      return 0;
+    } elsif (hex($arg) > 0x10FFFF) {
       return 0;
     }
   }



reply via email to

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