From: Jeff King Date: Wed, 21 Sep 2016 22:04:13 GMT Subject: Re: [PATCH v4 0/3] Fix a segfault caused by regexec() being called on mmap()ed data Message-ID: <20160921220413.5iedndabx7v6wdl7@sigill.intra.peff.net> In-Reply-To: On Wed, Sep 21, 2016 at 08:23:11PM +0200, Johannes Schindelin wrote: > We solve this by introducing a helper, regexec_buf(), that takes a > pointer and a length instead of a NUL-terminated string. > > This helper then uses REG_STARTEND where available, and falls back to > allocating and constructing a NUL-terminated string. Given the > wide-spread support for REG_STARTEND (Linux has it, MacOSX has it, Git > for Windows has it because it uses compat/regex/ that has it), I think > this is a fair trade-off. I did a double-take on this, but then read: > Changes since v3: > [...] > - removed fallback when REG_STARTEND is not supported, in favor of > requiring NO_REGEX. So I think we are all in agreement. :) With the exception of a few commit message fixups that Junio already pointed out, this looks good to me. Thanks. -Peff