[PATCH 00/10] grep/pcre2: memory allocation fixes
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Feb 4, 2021, 21:05 UTC
- Message-ID
- <20210204210556.25242-1-avarab@gmail.com>
- In-Reply-To
- <191d3a2280232ff98964fd42bfe0bc85ee3708f5.1571227824.git.gitgitgadget@gmail.com>
This series fixes up bugs in our PCRE v2 wrapper code and how it handles malloc()/free().
Junio: I'm splitting this off my recently sent 25 patch series, which I should probably have sent as an RFC: https://lore.kernel.org/git/20210203032811.14979-1-avarab@gmail.com/
It's on top of "next", as it would otherwise conflict with my in-flight ab/grep-pcre-invalid-utf8, ab/lose-grep-debug and ab/retire-pcre1.
06/10 is a follow-up improvement (not a fix, the in-flight works fine too) for ab/grep-pcre-invalid-utf8. The latter two just touch adjacent lines of code.
There's no notable new behavior here, just cleanup of existing functionality. In mid-2019 there was a lot of discussion around the code being fixed here:
https://lore.kernel.org/git/pull.306.git.gitgitgadget@gmail.com/#t
https://lore.kernel.org/git/pull.402.git.1571227613.gitgitgadget@gmail.com/As discussed in 08/10 I believe that fix was so difficult to get right because it was starting out with a fundamentally incorrect assumption about how PCRE v2's memory handling works. With 08-10/10 we end up with a much easier to reason about end-state, as the API itself is actually quite simple.
Ævar Arnfjörð Bjarmason (10):
grep/pcre2: drop needless assignment + assert() on opt->pcre2
grep/pcre2: drop needless assignment to NULL
grep/pcre2: correct reference to grep_init() in comment
grep/pcre2: prepare to add debugging to pcre2_malloc()
grep/pcre2: add GREP_PCRE2_DEBUG_MALLOC debug mode
grep/pcre2: use compile-time PCREv2 version test
grep/pcre2: use pcre2_maketables_free() function
grep/pcre2: actually make pcre2 use custom allocator
grep/pcre2: move back to thread-only PCREv2 structures
grep/pcre2: move definitions of pcre2_{malloc,free}builtin/grep.c | 1 - grep.c | 99 ++++++++++++++++++++++---------------------------- grep.h | 9 ++++- 3 files changed, 51 insertions(+), 58 deletions(-)
-- 2.30.0.284.gd98b1dd5eaa7