OSDN Git Service

Merge branch 'js/regexec-buf' into maint
authorJunio C Hamano <gitster@pobox.com>
Thu, 29 Sep 2016 23:49:44 +0000 (16:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 29 Sep 2016 23:49:45 +0000 (16:49 -0700)
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

1  2 
Makefile
diff.c
diffcore-pickaxe.c
git-compat-util.h
grep.c
xdiff-interface.c

diff --cc Makefile
+++ b/Makefile
@@@ -296,12 -296,8 +296,13 @@@ all:
  # Define USE_NED_ALLOCATOR if you want to replace the platforms default
  # memory allocators with the nedmalloc allocator written by Niall Douglas.
  #
- # Define NO_REGEX if you have no or inferior regex support in your C library.
 +# Define OVERRIDE_STRDUP to override the libc version of strdup(3).
 +# This is necessary when using a custom allocator in order to avoid
 +# crashes due to allocation and free working on different 'heaps'.
 +# It's defined automatically if USE_NED_ALLOCATOR is set.
 +#
+ # Define NO_REGEX if your C library lacks regex support with REG_STARTEND
+ # feature.
  #
  # Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
  # user.
diff --cc diff.c
Simple merge
Simple merge
Simple merge
diff --cc grep.c
Simple merge
Simple merge