Skip to content

Commit 4c9b93e

Browse files
committed
vcs-svn: verify that deltas consume all inline data
By constraining the format of deltas, we can more easily detect corruption and other breakage. Requiring deltas not to provide unconsumed data also opens the possibility of ignoring the declared amount of novel data and simply streaming the data as needed to fulfill copyfrom_data requests. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Ramkumar Ramachandra <artagnon@gmail.com>
1 parent ec71aa2 commit 4c9b93e

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

t/t9011-svn-da.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,10 @@ test_expect_success 'preimage view: reject truncated preimage' '
121121
test_must_fail test-svn-fe -d preimage clear.longread 9
122122
'
123123

124-
test_expect_success 'inline data' '
124+
test_expect_success 'forbid unconsumed inline data' '
125125
printf "SVNQ%b%s%b%s" "QQQQ\003" "bar" "QQQQ\001" "x" |
126126
q_to_nul >inline.clear &&
127-
test-svn-fe -d preimage inline.clear 18 >actual &&
128-
test_cmp empty actual
127+
test_must_fail test-svn-fe -d preimage inline.clear 18 >actual
129128
'
130129

131130
test_expect_success 'reject truncated inline data' '

vcs-svn/svndiff.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ static int apply_window_in_core(struct window *ctx)
208208
)
209209
if (execute_one_instruction(ctx, &instructions, &data_pos))
210210
return -1;
211+
if (data_pos != ctx->data.len)
212+
return error("invalid delta: does not copy all inline data");
211213
return 0;
212214
}
213215

0 commit comments

Comments
 (0)