@matheusbsbs / matheus-bagliano / commits / 4c9b93ed76
Fork 0

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>

Jonathan Nieder committed Oct 13, 2010 at 04:48 UTC 4c9b93ed7644a7a7c72bdd8105d88a9ebb8e3e74
2 files changed +4 -3
t/t9011-svn-da.sh
+2 -3
@@ -121,11 +121,10 @@ test_expect_success 'preimage view: reject truncated preimage' '
121 test_must_fail test-svn-fe -d preimage clear.longread 9
122 '
123
124 -test_expect_success 'inline data' '
124 +test_expect_success 'forbid unconsumed inline data' '
125 printf "SVNQ%b%s%b%s" "QQQQ\003" "bar" "QQQQ\001" "x" |
126 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
128 '
129
130 test_expect_success 'reject truncated inline data' '
vcs-svn/svndiff.c
+2
@@ -208,6 +208,8 @@ static int apply_window_in_core(struct window *ctx)
208 )
209 if (execute_one_instruction(ctx, &instructions, &data_pos))
210 return -1;
211 + if (data_pos != ctx->data.len)
212 + return error("invalid delta: does not copy all inline data");
213 return 0;
214 }
215