texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * info/nodes.c (info_create_tag), info/nodes.h (T


From: Patrice Dumas
Subject: branch master updated: * info/nodes.c (info_create_tag), info/nodes.h (TAG): set TAG nodestart to be size_t and initialize to 0. Indeed, right after info_create_tag is called, the tag nodestart is set to a non-negative value. It should not be possible to have 0 for nodestart from build_tag_table as there is at least the node separator. A bogus entry in tag table or a 0 in tag table is possible and although it is unlikely to be correct, nodestart can be adjusted.
Date: Mon, 07 Oct 2024 17:57:01 -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 4a6150efee * info/nodes.c (info_create_tag), info/nodes.h (TAG): set 
TAG nodestart to be size_t and initialize to 0.  Indeed, right after 
info_create_tag is called, the tag nodestart is set to a non-negative value.  
It should not be possible to have 0 for nodestart from build_tag_table as there 
is at least the node separator.  A bogus entry in tag table or a 0 in tag table 
is possible and although it is unlikely to be correct, nodestart can be 
adjusted.
4a6150efee is described below

commit 4a6150efee2fd51bbefccde6a131a0541e32c428
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Oct 7 23:56:48 2024 +0200

    * info/nodes.c (info_create_tag), info/nodes.h (TAG): set TAG
    nodestart to be size_t and initialize to 0.  Indeed, right after
    info_create_tag is called, the tag nodestart is set to a non-negative
    value.  It should not be possible to have 0 for nodestart from
    build_tag_table as there is at least the node separator.  A bogus
    entry in tag table or a 0 in tag table is possible and although it is
    unlikely to be correct, nodestart can be adjusted.
    
    * info/nodes.c (adjust_nodestart, info_node_of_tag_ext): remove
    conditions on tag->nodestart being >= 0, as it is always true.
---
 ChangeLog    | 13 +++++++++++++
 info/nodes.c |  6 +++---
 info/nodes.h |  2 +-
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7e28126f76..5ef10e4c27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-10-07  Patrice Dumas  <pertusus@free.fr>
+
+       * info/nodes.c (info_create_tag), info/nodes.h (TAG): set TAG
+       nodestart to be size_t and initialize to 0.  Indeed, right after
+       info_create_tag is called, the tag nodestart is set to a non-negative
+       value.  It should not be possible to have 0 for nodestart from
+       build_tag_table as there is at least the node separator.  A bogus
+       entry in tag table or a 0 in tag table is possible and although it is
+       unlikely to be correct, nodestart can be adjusted.
+
+       * info/nodes.c (adjust_nodestart, info_node_of_tag_ext): remove
+       conditions on tag->nodestart being >= 0, as it is always true.
+
 2024-10-07  Patrice Dumas  <pertusus@free.fr>
 
        * info/nodes.c (get_nodes_of_tags_table): ignore node with bogus
diff --git a/info/nodes.c b/info/nodes.c
index f54186560f..84b4de3a42 100644
--- a/info/nodes.c
+++ b/info/nodes.c
@@ -876,7 +876,7 @@ info_create_tag (void)
   memset (t, 0, sizeof (TAG));
   t->filename = 0;
   t->nodename = 0;
-  t->nodestart = -1;
+  t->nodestart = 0;
   t->nodestart_adjusted = -1;
   t->cache.nodelen = -1;
 
@@ -1118,7 +1118,7 @@ adjust_nodestart (FILE_BUFFER *fb, TAG *node)
   s.end = s.start + 1;
 
   /* Check that the given nodestart is in fact inside the file buffer. */
-  if (s.start >= 0 && s.start < fb->filesize)
+  if (s.start < fb->filesize)
     {
       /* Check for node separator at node->nodestart
          introducting this node. */
@@ -1238,7 +1238,7 @@ info_node_of_tag_ext (FILE_BUFFER *fb, TAG **tag_ptr, int 
fast)
 
   /* If we were able to find this file and load it, then return
      the node within it. */
-  if (!(tag->nodestart >= 0 && tag->nodestart < subfile->filesize))
+  if (!(tag->nodestart < subfile->filesize))
     return NULL;
 
   node = 0;
diff --git a/info/nodes.h b/info/nodes.h
index a432a1d237..aee102ff87 100644
--- a/info/nodes.h
+++ b/info/nodes.h
@@ -102,7 +102,7 @@ typedef struct {
 typedef struct {
   char *filename;               /* The file where this node can be found. */
   char *nodename;               /* The node pointed to by this tag. */
-  long nodestart;               /* The value read from the tag table. */
+  size_t nodestart;             /* The value read from the tag table. */
   long nodestart_adjusted;      /* Where the node or anchor actually is. */
   int flags;                    /* Same as NODE.flags. */
   NODE cache;                   /* Saved information about pointed-to node. */



reply via email to

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