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

fsfs: Segfault when rep line lists the all-zeroes checksum

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Mon, 29 Aug 2016 16:57:19 +0000

When the "props:" line in a noderev lists an all-zeroes checksum, FSFS

% cat repro.sh
rm -rf r wc
svnadmin create r
svn co -q file://`pwd`/r wc
svn ps -q k v wc
svn ci -qmm wc
echo "First dump:"
svnadmin dump -q r >/dev/null
perl -pi -e 's/[0-9a-f]{16,}/"0" x length $&/e if /^props:/' r/db/revs/0/1
echo "Second dump:"
svnadmin dump -q r >/dev/null

% ./repro.sh
First dump:
Second dump:
Segmentation fault
zsh: exit 139 ./repro.sh

This is caused by these two lines in svn_fs_fs__parse_representation():
 801 SVN_ERR(svn_checksum_parse_hex(&checksum, svn_checksum_md5, str,
 802 scratch_pool));
 803 memcpy(rep->md5_digest, checksum->digest, sizeof(rep->md5_digest));
LineĀ 801 sets CHECKSUM to NULL (as promised by svn_checksum_parse_hex()'s
docstring), lineĀ 803 dereferences it unconditionally.

I'm not aware of any way to create such text:/props: lines via the API,
but they're useful when editing revision files by hand, and in any case
invalid on-disk data should not cause segfaults.

Ivan bisected this to r1462727.


Received on 2016-08-29 18:57:45 CEST

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