[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5706] fix crashes when searching split file
From: |
Gavin D. Smith |
Subject: |
[5706] fix crashes when searching split file |
Date: |
Sat, 12 Jul 2014 01:45:03 +0000 |
Revision: 5706
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5706
Author: gavin
Date: 2014-07-12 01:45:00 +0000 (Sat, 12 Jul 2014)
Log Message:
-----------
fix crashes when searching split file
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/info-utils.c
trunk/info/nodes.c
trunk/info/nodes.h
trunk/info/session.c
trunk/info/t/infodir/split.info
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-07-11 09:52:22 UTC (rev 5705)
+++ trunk/ChangeLog 2014-07-12 01:45:00 UTC (rev 5706)
@@ -1,5 +1,14 @@
2014-07-11 Gavin Smith <address@hidden>
+ * info/info-utils.c (scan_node_contents): Call info_find_subfile to get
+ pointer to subfile contents when setting node_offset.
+
+ * info/session.c (info_search_internal): Don't free node if search was
+ successful because a reference to it was retained. (This reverses
+ change on 2014-07-05.)
+
+2014-07-11 Gavin Smith <address@hidden>
+
* info/info-utils.c (nodestart): Removed.
(node_offset): New variable.
(scan_node_contents): Initialize node_offset.
Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c 2014-07-11 09:52:22 UTC (rev 5705)
+++ trunk/info/info-utils.c 2014-07-12 01:45:00 UTC (rev 5706)
@@ -1552,6 +1552,8 @@
if (fb)
{
+ char *file_contents;
+
/* Set anchor_to_adjust to first anchor in node, if any. */
anchor_to_adjust = node_ptr + 1;
if (!*anchor_to_adjust)
@@ -1559,8 +1561,17 @@
else if (*anchor_to_adjust && (*anchor_to_adjust)->nodelen != 0)
anchor_to_adjust = 0;
+ if (!node->subfile)
+ file_contents = fb->contents;
+ else
+ {
+ FILE_BUFFER *f = info_find_subfile (node->subfile);
+ if (!f)
+ return; /* This shouldn't happen. */
+ file_contents = f->contents;
+ }
node_offset = node->nodestart
- + skip_node_separator (fb->contents + node->nodestart);
+ + skip_node_separator (file_contents + node->nodestart);
}
else
anchor_to_adjust = 0;
Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c 2014-07-11 09:52:22 UTC (rev 5705)
+++ trunk/info/nodes.c 2014-07-12 01:45:00 UTC (rev 5706)
@@ -560,7 +560,6 @@
/* Functions for retrieving files. */
static FILE_BUFFER *info_load_file (char *fullpath, int get_tags);
-static FILE_BUFFER *info_find_subfile (char *filename);
static void get_file_character_encoding (FILE_BUFFER *fb);
static void forget_info_file (char *filename);
static void info_reload_file_buffer_contents (FILE_BUFFER *fb);
@@ -672,7 +671,7 @@
/* Find a subfile of a split file. This differs from info_load_file in
that it does not fill in a tag table for the file. */
-static FILE_BUFFER *
+FILE_BUFFER *
info_find_subfile (char *fullpath)
{
char *with_extension = 0;
Modified: trunk/info/nodes.h
===================================================================
--- trunk/info/nodes.h 2014-07-11 09:52:22 UTC (rev 5705)
+++ trunk/info/nodes.h 2014-07-12 01:45:00 UTC (rev 5706)
@@ -148,6 +148,8 @@
return a NULL FILE_BUFFER *. */
extern FILE_BUFFER *info_find_file (char *filename);
+FILE_BUFFER *info_find_subfile (char *filename);
+
/* Return a pointer to a new NODE structure. */
extern NODE *info_create_node (void);
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2014-07-11 09:52:22 UTC (rev 5705)
+++ trunk/info/session.c 2014-07-12 01:45:00 UTC (rev 5706)
@@ -3667,7 +3667,6 @@
result = info_search_in_node_internal (string, node, start, window,
dir, case_sensitive, 1, use_regex, &ret, resbnd);
- free (node);
/* Did we find the string in this node? */
if (result == search_success)
@@ -3683,7 +3682,10 @@
return 0;
}
- /* No. Make sure that we haven't passed our starting point. */
+ /* No. Free this node, and make sure that we haven't passed
+ our starting point. */
+ free (node);
+
if (result == search_failure
|| strcmp (initial_nodename, tag->nodename) == 0)
return -1;
Modified: trunk/info/t/infodir/split.info
===================================================================
(Binary files differ)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5706] fix crashes when searching split file,
Gavin D. Smith <=