texinfo-commits
[Top][All Lists]
Advanced

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

texinfo ChangeLog info/nodes.c


From: Sergey Poznyakoff
Subject: texinfo ChangeLog info/nodes.c
Date: Thu, 07 Oct 2010 12:24:07 +0000

CVSROOT:        /cvsroot/texinfo
Module name:    texinfo
Changes by:     Sergey Poznyakoff <gray>        10/10/07 12:24:07

Modified files:
        .              : ChangeLog 
        info           : nodes.c 

Log message:
        Better handling for malformed info files.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/ChangeLog?cvsroot=texinfo&r1=1.1152&r2=1.1153
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/nodes.c?cvsroot=texinfo&r1=1.14&r2=1.15

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/texinfo/texinfo/ChangeLog,v
retrieving revision 1.1152
retrieving revision 1.1153
diff -u -b -r1.1152 -r1.1153
--- ChangeLog   1 Oct 2010 18:05:22 -0000       1.1152
+++ ChangeLog   7 Oct 2010 12:24:07 -0000       1.1153
@@ -1,3 +1,9 @@
+2010-10-07  Sergey Poznyakoff  <address@hidden>
+
+       * info/nodes.c (info_node_of_file_buffer_tags): Check if
+       tag->nodestart is valid.  Suggested by Hilmar Preusse
+       <address@hidden>.
+
 2010-10-01  Karl Berry  <address@hidden>
 
        * doc/texinfo.txi (Customizing Output Target Names): rename+edit.

Index: info/nodes.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/nodes.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- info/nodes.c        17 Mar 2010 22:01:05 -0000      1.14
+++ info/nodes.c        7 Oct 2010 12:24:07 -0000       1.15
@@ -1,5 +1,5 @@
 /* nodes.c -- how to get an Info file and node.
-   $Id: nodes.c,v 1.14 2010/03/17 22:01:05 pertusus Exp $
+   $Id: nodes.c,v 1.15 2010/10/07 12:24:07 gray Exp $
 
    Copyright (C) 1993, 1998, 1999, 2000, 2002, 2003, 2004, 2006, 2007,
    2008, 2009 Free Software Foundation, Inc.
@@ -946,6 +946,7 @@
   for (i = 0; (tag = file_buffer->tags[i]); i++)
     if (strcmp (nodename, tag->nodename) == 0)
       {
+       NODE *node;
         FILE_BUFFER *subfile = info_find_file_internal (tag->filename,
                                                         INFO_NO_TAGS);
         if (!subfile)
@@ -960,8 +961,10 @@
 
         /* If we were able to find this file and load it, then return
            the node within it. */
-        {
-          NODE *node = xmalloc (sizeof (NODE));
+       if (!(tag->nodestart >= 0 && tag->nodestart < subfile->filesize))
+         return NULL;
+
+       node = xmalloc (sizeof (NODE));
           node->filename    = subfile->fullpath;
           node->parent      = NULL;
           node->nodename    = tag->nodename;
@@ -1034,13 +1037,11 @@
               tag->nodelen = get_node_length (&node_body);
               node->nodelen = tag->nodelen;
             }
-
           else if (tag->nodelen == 0) /* anchor, return containing node */
             {
               free (node);
               node = find_node_of_anchor (file_buffer, tag);
             }
-
           else
             {
               /* Since we know the length of this node, we have already
@@ -1052,7 +1053,6 @@
 
           return node;
         }
-      }
 
   /* There was a tag table for this file, and the node wasn't found.
      Return NULL, since this file doesn't contain the desired node. */



reply via email to

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