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
git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1880374 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/subversion/libsvn_fs_fs/index.c b/subversion/libsvn_fs_fs/index.c
index ed87c70..3d6b704 100644
--- a/subversion/libsvn_fs_fs/index.c
+++ b/subversion/libsvn_fs_fs/index.c
@@ -827,7 +827,7 @@
&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 */
diff --git a/subversion/libsvn_fs_x/index.c b/subversion/libsvn_fs_x/index.c
index ca63d95..fde054e 100644
--- a/subversion/libsvn_fs_x/index.c
+++ b/subversion/libsvn_fs_x/index.c
@@ -953,7 +953,7 @@
&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_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));