texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Stop calling hv_fetch with null argument


From: Gavin D. Smith
Subject: branch master updated: Stop calling hv_fetch with null argument
Date: Fri, 23 Feb 2024 16:06:16 -0500

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

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 70602c4ce8 Stop calling hv_fetch with null argument
70602c4ce8 is described below

commit 70602c4ce87a5aeb4f0a2578536a30f781fd3cd4
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Fri Feb 23 21:06:00 2024 +0000

    Stop calling hv_fetch with null argument
    
    * tp/texi2any.pl: Avoid calling Texinfo::Document::remove_document
    with undef argument.
    
    * tp/Texinfo/XS/main/get_perl_info.c (get_document_or_warn):
    Check if hash obtained from argument is null.
    
    This is the case in test_scripts/formatting_info_extension_warning.sh.
---
 ChangeLog                          | 12 ++++++++++++
 tp/Texinfo/XS/main/get_perl_info.c |  5 +++++
 tp/texi2any.pl                     |  2 +-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index b85ec15a06..d8a470d23e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-02-23  Gavin Smith <gavinsmith0123@gmail.com>
+
+       Stop calling hv_fetch with null argument
+
+       * tp/texi2any.pl: Avoid calling Texinfo::Document::remove_document
+       with undef argument.
+
+       * tp/Texinfo/XS/main/get_perl_info.c (get_document_or_warn):
+       Check if hash obtained from argument is null.
+
+       This is the case in test_scripts/formatting_info_extension_warning.sh.
+
 2024-02-23  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/t/test_parse_texi_line.t: invert order of Test::More::is test
diff --git a/tp/Texinfo/XS/main/get_perl_info.c 
b/tp/Texinfo/XS/main/get_perl_info.c
index dcd1b2931a..36bc8061e6 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -117,6 +117,11 @@ get_document_or_warn (SV *sv_in, char *key, char 
*warn_string)
   dTHX;
 
   hv_in = (HV *)SvRV (sv_in);
+  if (!hv_in)
+    {
+      fprintf (stderr, "ERROR: %s: no hash\n", warn_string);
+      return 0;
+    }
   document_descriptor_sv = hv_fetch (hv_in, key, strlen (key), 0);
   if (document_descriptor_sv && SvOK (*document_descriptor_sv))
     {
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index ed97c40caa..a2d9ea3803 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1890,7 +1890,7 @@ while(@input_files) {
 
   $converter->destroy();
  NEXT:
-  Texinfo::Document::remove_document($document);
+  Texinfo::Document::remove_document($document) if defined($document);
 }
 
 foreach my $unclosed_file (keys(%main_unclosed_files)) {



reply via email to

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