texinfo-commits
[Top][All Lists]
Advanced

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

[7907] fix crash in incremental search for \


From: gavinsmith0123
Subject: [7907] fix crash in incremental search for \
Date: Wed, 5 Jul 2017 15:16:45 -0400 (EDT)

Revision: 7907
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7907
Author:   gavin
Date:     2017-07-05 15:16:44 -0400 (Wed, 05 Jul 2017)
Log Message:
-----------
fix crash in incremental search for \

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/search.c
    trunk/info/session.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2017-07-05 17:56:51 UTC (rev 7906)
+++ trunk/ChangeLog     2017-07-05 19:16:44 UTC (rev 7907)
@@ -1,5 +1,15 @@
 2017-07-05  Gavin Smith  <address@hidden>
 
+       * info/search.c (regexp_search): Call free_matches if the regex
+       could be compiled, but there were no matches.  Free a string
+       buffer used for displaying an error message.
+       * info/session.c (info_search_in_node_internal): Do not call
+       free_matches.  It could be called on uninitialised data leading
+       to a crash if the regex had an error in it.  Marco Maggi reported
+       a crash for incremental search when a single \ was entered.
+
+2017-07-05  Gavin Smith  <address@hidden>
+
        * util/texi2dvi (sorted_index_filter): Remove code to list files 
        created with bibtex, as then xref_files_changed requires them to 
        exist (since change on 2017-06-21) and they won't if bibtex is 

Modified: trunk/info/search.c
===================================================================
--- trunk/info/search.c 2017-07-05 17:56:51 UTC (rev 7906)
+++ trunk/info/search.c 2017-07-05 19:16:44 UTC (rev 7907)
@@ -174,8 +174,8 @@
   state->match_count = match_count;
 }
 
-/* Search BUFFER for REGEXP.  Pass back the list of matches
-   in MATCH_STATE. */
+/* Search BUFFER for REGEXP.  If matches are found, pass back the list of 
+   matches in MATCH_STATE. */
 enum search_result
 regexp_search (char *regexp, int is_literal, int is_insensitive,
                char *buffer, size_t buflen,
@@ -201,6 +201,7 @@
       char *buf = xmalloc (size);
       regerror (result, &preg, buf, size);
       info_error (_("regexp error: %s"), buf);
+      free (buf);
       return search_invalid;
     }
 
@@ -215,7 +216,10 @@
   extend_matches (match_state);
 
   if (match_state->match_count == 0)
-    return search_not_found;
+    {
+      free_matches (match_state);
+      return search_not_found;
+    }
   else
     return search_success;
 }

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2017-07-05 17:56:51 UTC (rev 7906)
+++ trunk/info/session.c        2017-07-05 19:16:44 UTC (rev 7907)
@@ -3953,10 +3953,7 @@
     }
   
   if (result != search_success)
-    {
-      free_matches (&matches);
-      return result;
-    }
+    return result;
 
   if (node->flags & N_Simple)
     {




reply via email to

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