Author: hartmannathan
Date: Tue Jul 28 14:38:35 2020
New Revision: 1880374
URL: http://svn.apache.org/viewvc?rev=1880374&view=rev
Log:
Fix harmless uninitialized read in svn_fs_*_index_append
* subversion/libsvn_fs_fs/index.c (svn_fs_fs__l2p_index_append),
subversion/libsvn_fs_x/index.c
(svn_fs_x__l2p_index_append, svn_fs_x__p2l_index_append):
Do not access entry fields that are unset due to reaching eof.
Found by: Clang 10 memory sanitizer
Patch by: Orivej Desh <orivej{_AT_}gmx.fr>
Reviewed by: danielsh (svn_fs_fs__l2p_index_append)
hartmannathan
Modified:
subversion/trunk/subversion/libsvn_fs_fs/index.c
subversion/trunk/subversion/libsvn_fs_x/index.c
Modified: subversion/trunk/subversion/libsvn_fs_fs/index.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/index.c?rev=1880374&r1=1880373&r2=1880374&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/index.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/index.c Tue Jul 28 14:38:35 2020
@@ -827,7 +827,7 @@ svn_fs_fs__l2p_index_append(svn_checksum
&eof, local_pool));
/* handle new revision */
- if ((entry > 0 && proto_entry.offset == 0) || eof)
+ if (eof || (entry > 0 && proto_entry.offset == 0))
{
/* dump entries, grouped into pages */
Modified: subversion/trunk/subversion/libsvn_fs_x/index.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/index.c?rev=1880374&r1=1880373&r2=1880374&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/index.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/index.c Tue Jul 28 14:38:35 2020
@@ -953,7 +953,7 @@ svn_fs_x__l2p_index_append(svn_checksum_
&eof, local_pool));
/* handle new revision */
- if ((entry > 0 && proto_entry.offset == 0) || eof)
+ if (eof || (entry > 0 && proto_entry.offset == 0))
{
/* dump entries, grouped into pages */
@@ -2219,7 +2219,7 @@ svn_fs_x__p2l_index_append(svn_checksum_
SVN_ERR(read_p2l_entry_from_proto_index(proto_index, &entry,
&eof, iterpool));
- if (entry.item_count && !eof)
+ if (!eof && entry.item_count)
{
entry.items = apr_palloc(iterpool,
entry.item_count * sizeof(*entry.items));