You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/03/02 00:15:37 UTC

svn commit: r1573237 - /subversion/trunk/subversion/libsvn_fs_x/index.c

Author: stefan2
Date: Sat Mar  1 23:15:36 2014
New Revision: 1573237

URL: http://svn.apache.org/r1573237
Log:
Fix an unitialized memory read reported by valgrind.  The reason was that
the entry struct type for the proto-index containes padding bytes (only
20 out of the 24 bytes are actually used by struct members). 

* subversion/libsvn_fs_x/index.c
  (svn_fs_x__l2p_proto_index_add_revision,
   svn_fs_x__l2p_proto_index_add_entry): Fully initialize the struct before
                                         writing it to the proto index file.
                                         Beware of padding!

Found by: philip

Modified:
    subversion/trunk/subversion/libsvn_fs_x/index.c

Modified: subversion/trunk/subversion/libsvn_fs_x/index.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/index.c?rev=1573237&r1=1573236&r2=1573237&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/index.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/index.c Sat Mar  1 23:15:36 2014
@@ -439,10 +439,7 @@ svn_error_t *
 svn_fs_x__l2p_proto_index_add_revision(apr_file_t *proto_index,
                                        apr_pool_t *pool)
 {
-  l2p_proto_entry_t entry;
-  entry.offset = 0;
-  entry.item_index = 0;
-
+  l2p_proto_entry_t entry = { 0 };
   return svn_error_trace(write_entry_to_proto_index(proto_index, entry,
                                                     pool));
 }
@@ -454,7 +451,7 @@ svn_fs_x__l2p_proto_index_add_entry(apr_
                                     apr_uint64_t item_index,
                                     apr_pool_t *pool)
 {
-  l2p_proto_entry_t entry;
+  l2p_proto_entry_t entry = { 0 };
 
   /* make sure the conversion to uint64 works */
   SVN_ERR_ASSERT(offset >= -1);