Check that the declared output size for each window is correct, and reserve that amount of space in the output buffer in advance. Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx> --- vcs-svn/svndiff.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/vcs-svn/svndiff.c b/vcs-svn/svndiff.c index ac776e0..c03cd7e 100644 --- a/vcs-svn/svndiff.c +++ b/vcs-svn/svndiff.c @@ -220,10 +220,15 @@ static int apply_one_window(struct line_buffer *delta, off_t *delta_len, rv = error("Cannot read delta: %s", strerror(errno)); goto done; } + strbuf_grow(&ctx.out, out_len); if (apply_window_in_core(&ctx) || write_strbuf(&ctx.out, out)) { rv = -1; goto done; } + if (ctx.out.len != out_len) { + rv = error("Invalid delta: incorrect postimage length"); + goto done; + } done: strbuf_release(&ctx.data); strbuf_release(&ctx.instructions); -- 1.7.2.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html