diff options
Diffstat (limited to 'tests/patch')
-rw-r--r-- | tests/patch/parse.c | 8 | ||||
-rw-r--r-- | tests/patch/patch_common.h | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/patch/parse.c b/tests/patch/parse.c index 0c4eccc52..3f89eb51a 100644 --- a/tests/patch/parse.c +++ b/tests/patch/parse.c @@ -184,6 +184,14 @@ void test_patch_parse__binary_file_path_without_body_paths(void) strlen(PATCH_BINARY_FILE_PATH_WITHOUT_BODY_PATHS), NULL)); } +void test_patch_parse__binary_file_with_truncated_delta(void) +{ + git_patch *patch; + cl_git_fail(git_patch_from_buffer(&patch, PATCH_BINARY_FILE_WITH_TRUNCATED_DELTA, + strlen(PATCH_BINARY_FILE_WITH_TRUNCATED_DELTA), NULL)); + cl_assert_equal_s(git_error_last()->message, "truncated binary data at line 5"); +} + void test_patch_parse__memory_leak_on_multiple_paths(void) { git_patch *patch; diff --git a/tests/patch/patch_common.h b/tests/patch/patch_common.h index 660168551..731524767 100644 --- a/tests/patch/patch_common.h +++ b/tests/patch/patch_common.h @@ -974,6 +974,13 @@ "+++ \n" \ "Binary files a b c and d e f differ" +#define PATCH_BINARY_FILE_WITH_TRUNCATED_DELTA \ + "diff --git a/file b/file\n" \ + "index 1420..b71f\n" \ + "GIT binary patch\n" \ + "delta 7\n" \ + "d" + #define PATCH_MULTIPLE_OLD_PATHS \ "diff --git \n" \ "--- \n" \ |