aboutsummaryrefslogtreecommitdiff
path: root/t/t9010-svn-fe.sh
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2011-05-27 05:44:27 -0500
committerJonathan Nieder <jrnieder@gmail.com>2011-06-15 02:32:50 -0500
commit3ac10b2e3fd6d858621f796160d251ad34affc20 (patch)
treea8a247ae4053480219c6c2dad47c9466a888c0f0 /t/t9010-svn-fe.sh
parentabe27c0cbd97bf6a693004ddb411392ed596a853 (diff)
downloadgit-3ac10b2e3fd6d858621f796160d251ad34affc20.tar.gz
git-3ac10b2e3fd6d858621f796160d251ad34affc20.tar.xz
vcs-svn: avoid hangs from corrupt deltas
A corrupt Subversion-format delta can request reads past the end of the preimage. Set sliding_view::max_off so such corruption is caught when it appears rather than blocking in an impossible-to-fulfill read() when input is coming from a socket or pipe. Inspired-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Diffstat (limited to 't/t9010-svn-fe.sh')
-rwxr-xr-xt/t9010-svn-fe.sh40
1 files changed, 37 insertions, 3 deletions
diff --git a/t/t9010-svn-fe.sh b/t/t9010-svn-fe.sh
index f24f004fd..b7eed2489 100755
--- a/t/t9010-svn-fe.sh
+++ b/t/t9010-svn-fe.sh
@@ -18,12 +18,13 @@ reinit_git () {
try_dump () {
input=$1 &&
- maybe_fail=${2:+test_$2} &&
+ maybe_fail_svnfe=${2:+test_$2} &&
+ maybe_fail_fi=${3:+test_$3} &&
{
- $maybe_fail test-svn-fe "$input" >stream 3<backflow &
+ $maybe_fail_svnfe test-svn-fe "$input" >stream 3<backflow &
} &&
- git fast-import --cat-blob-fd=3 <stream 3>backflow &&
+ $maybe_fail_fi git fast-import --cat-blob-fd=3 <stream 3>backflow &&
wait $!
}
@@ -1047,6 +1048,39 @@ test_expect_success PIPE 'deltas need not consume the whole preimage' '
test_cmp expect.3 actual.3
'
+test_expect_success PIPE 'no hang for delta trying to read past end of preimage' '
+ reinit_git &&
+ {
+ # COPY 1
+ printf "SVNQ%b%b" "Q\001\001\002Q" "\001Q" |
+ q_to_nul
+ } >greedy.delta &&
+ {
+ cat <<-\EOF &&
+ SVN-fs-dump-format-version: 3
+
+ Revision-number: 1
+ Prop-content-length: 10
+ Content-length: 10
+
+ PROPS-END
+
+ Node-path: bootstrap
+ Node-kind: file
+ Node-action: add
+ Text-delta: true
+ Prop-content-length: 10
+ EOF
+ echo Text-content-length: $(wc -c <greedy.delta) &&
+ echo Content-length: $((10 + $(wc -c <greedy.delta))) &&
+ echo &&
+ echo PROPS-END &&
+ cat greedy.delta &&
+ echo
+ } >greedydelta.dump &&
+ try_dump greedydelta.dump must_fail might_fail
+'
+
test_expect_success 'set up svn repo' '
svnconf=$PWD/svnconf &&
mkdir -p "$svnconf" &&