summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-09-26 16:09:19 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-09-26 16:09:19 -0700
commit6a67695268562f67babdb7d5195c8a43cc4015fa (patch)
treeb5bbacc08e466f6de62cf2e9fd450d71ef0ea6c7 /t
parentMerge branch 'nd/checkout-disambiguation' (diff)
parentregex: use regexec_buf() (diff)
downloadtgif-6a67695268562f67babdb7d5195c8a43cc4015fa.tar.xz
Merge branch 'js/regexec-buf'
Some codepaths in "git diff" used regexec(3) on a buffer that was mmap(2)ed, which may not have a terminating NUL, leading to a read beyond the end of the mapped region. This was fixed by introducing a regexec_buf() helper that takes a <ptr,len> pair with REG_STARTEND extension. * js/regexec-buf: regex: use regexec_buf() regex: add regexec_buf() that can work on a non NUL-terminated string regex: -G<pattern> feeds a non NUL-terminated string to regexec() and fails
Diffstat (limited to 't')
-rwxr-xr-xt/t4062-diff-pickaxe.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t4062-diff-pickaxe.sh b/t/t4062-diff-pickaxe.sh
new file mode 100755
index 0000000000..f0bf50bda7
--- /dev/null
+++ b/t/t4062-diff-pickaxe.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Copyright (c) 2016 Johannes Schindelin
+#
+
+test_description='Pickaxe options'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ test_commit initial &&
+ printf "%04096d" 0 >4096-zeroes.txt &&
+ git add 4096-zeroes.txt &&
+ test_tick &&
+ git commit -m "A 4k file"
+'
+test_expect_success '-G matches' '
+ git diff --name-only -G "^0{4096}$" HEAD^ >out &&
+ test 4096-zeroes.txt = "$(cat out)"
+'
+
+test_done