Skip to content

Commit

Permalink
vcs-svn: verify that deltas consume all inline data
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jonathan Nieder committed Mar 28, 2011
1 parent ec71aa2 commit 4c9b93e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions t/t9011-svn-da.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,10 @@ test_expect_success 'preimage view: reject truncated preimage' '
test_must_fail test-svn-fe -d preimage clear.longread 9
'

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

test_expect_success 'reject truncated inline data' '
Expand Down
2 changes: 2 additions & 0 deletions vcs-svn/svndiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ static int apply_window_in_core(struct window *ctx)
)
if (execute_one_instruction(ctx, &instructions, &data_pos))
return -1;
if (data_pos != ctx->data.len)
return error("invalid delta: does not copy all inline data");
return 0;
}

Expand Down

0 comments on commit 4c9b93e

Please sign in to comment.