Checkout
Julian Foad
committed
on 30 Dec 19
Avoid aborting on assertion failure in the area of mergeinfo calculations.

Instead, raise a catchable assertion error.

If an error occurs … Show more
Avoid aborting on assertion failure in the area of mergeinfo calculations.

Instead, raise a catchable assertion error.

If an error occurs in svn_rangelist_merge2(), produce a more detailed error

message to aid in debugging.

Introduce and use 'svn_sort__array_insert2()' which checks its inputs.  The

old version of this function was aborting on out-of-range inputs.  Introduce

and use 'svn_sort__array_delete2()' likewise, as similar issues may show up

here too.  The old version of this function was ignoring calls with

out-of-range inputs.  The old versions of both functions are still in use

elsewhere in the Subversion libraries.

For issue #4840, "Merge assertion failure in svn_sort__array_insert".

* subversion/include/private/svn_sorts_private.h,

 subversion/libsvn_subr/sorts.c

 (svn_sort__array_insert2,

  svn_sort__array_delete2): New.

* subversion/libsvn_client/merge.c

 (slice_remaining_ranges,

  insert_child_to_merge): Allow returning an error.

 Everywhere: use svn_sort__array_insert2() and svn_sort__array_delete2().

* subversion/libsvn_subr/mergeinfo.c

 (adjust_remaining_ranges): Allow returning an error.

 (dual_dump): Replace this old debug helper...

 (rangelist_to_string_debug): ... with this new one.

 (svn_rangelist_merge2): Extract the body of this function into a local

   'rangelist_merge2', leaving the original as an error-checking

   wrapper. If an error occurs, report its inputs.

 (rangelist_is_sorted): New.

 Everywhere: use svn_sort__array_insert2() and svn_sort__array_delete2().

* subversion/tests/libsvn_subr/mergeinfo-test.c

 (test_rangelist_merge_random_non_validated_inputs): Expect assertion

   failures; ignore them.

 (test_funcs): Expect that test to pass now.

Show less