You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by pb...@apache.org on 2013/06/24 18:15:28 UTC

svn commit: r1496110 - /subversion/trunk/subversion/libsvn_client/log.c

Author: pburba
Date: Mon Jun 24 16:15:27 2013
New Revision: 1496110

URL: http://svn.apache.org/r1496110
Log:
Avoid a segfault in svn_client_log5, see
http://svn.haxx.se/dev/archive-2013-06/0522.shtml

* subversion/libsvn_client/log.c
  (run_ra_get_log): bsearch can return NULL, so handle that.

Modified:
    subversion/trunk/subversion/libsvn_client/log.c

Modified: subversion/trunk/subversion/libsvn_client/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/log.c?rev=1496110&r1=1496109&r2=1496110&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/log.c (original)
+++ subversion/trunk/subversion/libsvn_client/log.c Mon Jun 24 16:15:27 2013
@@ -712,7 +712,17 @@ run_ra_get_log(apr_array_header_t *revis
       matching_segment = bsearch(&younger_rev, log_segments->elts,
                                  log_segments->nelts, log_segments->elt_size,
                                  compare_rev_to_segment);
-      SVN_ERR_ASSERT(*matching_segment);
+      /* LOG_SEGMENTS is supposed to represent the history of PATHS from
+         the oldest to youngest revs in REVISION_RANGES.  This function's
+         current sole caller svn_client_log5 *should* be providing
+         LOG_SEGMENTS that span the oldest to youngest revs in
+         REVISION_RANGES, even if one or more of the svn_location_segment_t's
+         returned have NULL path members indicating a gap in the history. So
+         MATCHING_SEGMENT should never be NULL, but clearly sometimes it is,
+         see http://svn.haxx.se/dev/archive-2013-06/0522.shtml
+         So to be safe we handle that case. */
+      if (matching_segment == NULL)
+        continue;
       
       /* A segment with a NULL path means there is gap in the history.
          We'll just proceed and let svn_ra_get_log2 fail with a useful