test_must_fail test-svn-fe -d preimage inline.trunc 10
'
+test_expect_success 'reject truncated inline data (after instruction section)' '
+ printf "SVNQ%b%b%s" "QQ\001\001\003" "\0201" "b" | q_to_nul >insn.trunc &&
+ test_must_fail test-svn-fe -d preimage insn.trunc 11
+'
+
test_done
#define VLI_BITS_PER_DIGIT 7
struct window {
+ struct strbuf instructions;
struct strbuf data;
};
-#define WINDOW_INIT { STRBUF_INIT }
+#define WINDOW_INIT { STRBUF_INIT, STRBUF_INIT }
static void window_release(struct window *ctx)
{
+ strbuf_release(&ctx->instructions);
strbuf_release(&ctx->data);
}
/* "source view" offset and length already handled; */
if (read_length(delta, &out_len, delta_len) ||
read_length(delta, &instructions_len, delta_len) ||
- read_length(delta, &data_len, delta_len))
+ read_length(delta, &data_len, delta_len) ||
+ read_chunk(delta, delta_len, &ctx.instructions, instructions_len))
goto error_out;
if (instructions_len) {
error("What do you think I am? A delta applier?");