diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2018-07-09 23:10:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-09 23:10:05 +0100 |
| commit | 6dfc8bc2499db78eae4e29dd121c75121f0e8baf (patch) | |
| tree | 3f1b096f8427fb597eb9aaca34247f81156cb746 /tests | |
| parent | 290292b4b20f36920ff1ce1f079c6cf216eb8605 (diff) | |
| parent | e087c0de70f43956125cb4deacdc8dd2a8687367 (diff) | |
| download | libgit2-6dfc8bc2499db78eae4e29dd121c75121f0e8baf.tar.gz | |
Merge pull request #4719 from pks-t/pks/delta-oob
Delta OOB access
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/delta/apply.c | 21 | ||||
| -rw-r--r-- | tests/diff/binary.c | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/delta/apply.c b/tests/delta/apply.c new file mode 100644 index 000000000..5bb95a283 --- /dev/null +++ b/tests/delta/apply.c @@ -0,0 +1,21 @@ +#include "clar_libgit2.h" + +#include "delta.h" + +void test_delta_apply__read_at_off(void) +{ + unsigned char base[16] = { 0 }, delta[] = { 0x10, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0x10, 0x00, 0x00 }; + void *out; + size_t outlen; + + cl_git_fail(git_delta_apply(&out, &outlen, base, sizeof(base), delta, sizeof(delta))); +} + +void test_delta_apply__read_after_limit(void) +{ + unsigned char base[16] = { 0 }, delta[] = { 0x10, 0x70, 0xff }; + void *out; + size_t outlen; + + cl_git_fail(git_delta_apply(&out, &outlen, base, sizeof(base), delta, sizeof(delta))); +} diff --git a/tests/diff/binary.c b/tests/diff/binary.c index 711fe6473..7edf37b51 100644 --- a/tests/diff/binary.c +++ b/tests/diff/binary.c @@ -3,6 +3,7 @@ #include "git2/sys/diff.h" #include "buffer.h" +#include "delta.h" #include "filebuf.h" #include "repository.h" |
