subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject svn commit: r1676667 - /subversion/trunk/subversion/libsvn_fs_fs/cached_data.c
Date Wed, 29 Apr 2015 04:51:46 GMT
Author: stefan2
Date: Wed Apr 29 04:51:46 2015
New Revision: 1676667

In FSFS, fix the delta combining code for the case that the delta chain
starts with a PLAIN rep and some DELTA rep in the chain has 0 source ops,
i.e. is "all new contents".

>From 1.7 and earlier, we carried over an optimization that stops walking
the delta chain when a delta window would use any string from the older
delta window.  If the delta chain starts with an PLAIN rep, the new 1.8
code assumed that not having read a base rep implies that we need to read
said PLAIN rep.  However, in case of the short-cut kicking in, it would
wrongly read the omitted DELTA rep as PLAIN rep of fulltext window size.
The result would not be used (SCR_OPS=0) but the read may be beyond EOF,
triggering an I/O error.

So, this fixes a data re-construction bug, not a repo corruption.

* subversion/libsvn_fs_fs/cached_data.c
  (get_combined_window): Don't attempt to read the source window if we
                         already decided that we don't need it.

Reported by: rschupp


Modified: subversion/trunk/subversion/libsvn_fs_fs/cached_data.c
--- subversion/trunk/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/cached_data.c Wed Apr 29 04:51:46 2015
@@ -1709,9 +1709,11 @@ get_combined_window(svn_stringbuf_t **re
       /* Maybe, we've got a PLAIN start representation.  If we do, read
          as much data from it as the needed for the txdelta window's source
-         Note that BUF / SOURCE may only be NULL in the first iteration. */
+         Note that BUF / SOURCE may only be NULL in the first iteration.
+         Also note that we may have short-cut reading the delta chain --
+         in which case SRC_OPS is 0 and it might not be a PLAIN rep. */
       source = buf;
-      if (source == NULL && rb->src_state != NULL)
+      if (source == NULL && rb->src_state != NULL && window->src_ops)
         SVN_ERR(read_plain_window(&source, rb->src_state, window->sview_len,
                                   pool, iterpool));

View raw message