[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: choose_delta_base shift problem

From: Stefan Fuhrmann <stefan.fuhrmann_at_wandisco.com>
Date: Tue, 29 Apr 2014 13:14:31 +0200

On Fri, Apr 25, 2014 at 11:37 AM, Philip Martin
<philip.martin_at_wandisco.com>wrote:

> Experimenting with gcc 4.9's -fsantize=undefined I got a warning:
>
> $ svnadmin create repo
> $ svn mkdir -mm file://`pwd`/repo/A
> ../src/subversion/libsvn_fs_fs/transaction.c:1978:14: runtime error: shift
> exponent -1 is negative
>
> The code is
>
> 1976 /* We also don't want the linear deltification to span more
> shards
> 1977 than deltas would be used in the simple skip-delta schme.
> */
> 1978 if ((1 << (--shards)) <= walk)
> 1979 count = noderev->predecessor_count - 1;
>

The bug is that shards can be 0 to begin with.
Any non-zero walk needs to start somewhere ...
(and walk cannot be 0 here).

> Perhaps something like this:
>
> Index: subversion/libsvn_fs_fs/transaction.c
> ===================================================================
> --- subversion/libsvn_fs_fs/transaction.c (revision 1589957)
> +++ subversion/libsvn_fs_fs/transaction.c (working copy)
> @@ -1975,7 +1975,7 @@ choose_delta_base(representation_t **rep,
>
> /* We also don't want the linear deltification to span more shards
> than deltas would be used in the simple skip-delta schme. */
> - if ((1 << (--shards)) <= walk)
> + if (shards > 0 && (1 << (--shards)) <= walk)
> count = noderev->predecessor_count - 1;
> }
>

I decided to fix the problem in the shards_spanned()
function - see r1590383.

Thanks for experimenting!

-- Stefan^2.
Received on 2014-04-29 13:15:09 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.