Author: julianfoad Date: Fri Dec 27 15:08:31 2019 New Revision: 1872030 URL: http://svn.apache.org/viewvc?rev=1872030&view=rev Log: Avoid converting invalid mergeinfo to bogus valid-looking mergeinfo.
For issue #4840, "Merge assertion failure in svn_sort__array_insert". The internal representation of mergeinfo is not supposed to include empty ranges. If a representation of an empty range did occur, perhaps due to a bug in mergeinfo processing or improper data passed to an API, the mergeinfo printing functions produced bogus valid-looking output. For example, for a range with (.start == .end == 10), it wrote "10-11". This was very confusing when seen in error messages and debugging. Instead, print a diagnostic output in the form "[empty-range@10*]". This output is not intended be accepted as input by the parsing functions. * subversion/libsvn_subr/mergeinfo.c (range_to_string): Print diagnostic output instead of bogus output for an empty range. Modified: subversion/trunk/subversion/libsvn_subr/mergeinfo.c Modified: subversion/trunk/subversion/libsvn_subr/mergeinfo.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/mergeinfo.c?rev=1872030&r1=1872029&r2=1872030&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_subr/mergeinfo.c (original) +++ subversion/trunk/subversion/libsvn_subr/mergeinfo.c Fri Dec 27 15:08:31 2019 @@ -470,8 +470,10 @@ range_to_string(const svn_merge_range_t return apr_psprintf(pool, "-%ld%s", range->start, mark); else if (range->start < range->end) return apr_psprintf(pool, "%ld-%ld%s", range->start + 1, range->end, mark); - else + else if (range->start > range->end) return apr_psprintf(pool, "%ld-%ld%s", range->start, range->end + 1, mark); + else + return apr_psprintf(pool, "[empty-range@%ld%s]", range->start, mark); } /* Helper for svn_mergeinfo_parse()