diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-09-17 22:53:58 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-09-17 22:53:58 +0200 |
commit | 07703ae057f5f6952d9ea4ee1cc34bfc889b4c5b (patch) | |
tree | 14d3293c6a081f04ec6bbca4d08286fd44a16de6 /t/helper | |
parent | Merge branch 'ds/commit-graph-tests' (diff) | |
parent | t5303: use printf to generate delta bases (diff) | |
download | git-07703ae057f5f6952d9ea4ee1cc34bfc889b4c5b.tar.xz git-07703ae057f5f6952d9ea4ee1cc34bfc889b4c5b.zip |
Merge branch 'jk/patch-corrupted-delta-fix'
Malformed or crafted data in packstream can make our code attempt
to read or write past the allocated buffer and abort, instead of
reporting an error, which has been fixed.
* jk/patch-corrupted-delta-fix:
t5303: use printf to generate delta bases
patch-delta: handle truncated copy parameters
patch-delta: consistently report corruption
patch-delta: fix oob read
t5303: test some corrupt deltas
test-delta: read input into a heap buffer
Diffstat (limited to 't/helper')
-rw-r--r-- | t/helper/test-delta.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/t/helper/test-delta.c b/t/helper/test-delta.c index 34c7259248..e749a49c88 100644 --- a/t/helper/test-delta.c +++ b/t/helper/test-delta.c @@ -34,8 +34,8 @@ int cmd__delta(int argc, const char **argv) return 1; } from_size = st.st_size; - from_buf = mmap(NULL, from_size, PROT_READ, MAP_PRIVATE, fd, 0); - if (from_buf == MAP_FAILED) { + from_buf = xmalloc(from_size); + if (read_in_full(fd, from_buf, from_size) < 0) { perror(argv[2]); close(fd); return 1; @@ -48,8 +48,8 @@ int cmd__delta(int argc, const char **argv) return 1; } data_size = st.st_size; - data_buf = mmap(NULL, data_size, PROT_READ, MAP_PRIVATE, fd, 0); - if (data_buf == MAP_FAILED) { + data_buf = xmalloc(data_size); + if (read_in_full(fd, data_buf, data_size) < 0) { perror(argv[3]); close(fd); return 1; |