diff options
author | René Scharfe <l.s.r@web.de> | 2021-06-30 18:12:43 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-06-30 14:19:03 -0700 |
commit | fe7fe62d8da0949d9b2bca34467b349bd294e91b (patch) | |
tree | fbac7dfc8393c1aae8245f860fc1ab102215530b /t/helper/test-xml-encode.c | |
parent | Git 2.20.5 (diff) | |
download | tgif-fe7fe62d8da0949d9b2bca34467b349bd294e91b.tar.xz |
grep: report missing left operand of --and
Git grep allows combining two patterns with --and. It checks and
reports if the second pattern is missing when compiling the expression.
A missing first pattern, however, is only reported later at match time.
Thus no error is returned if no matching is done, e.g. because no file
matches the also given pathspec.
When that happens we get an expression tree with an GREP_NODE_AND node
and a NULL pointer to the missing left child. free_pattern_expr()
tries to dereference it during the cleanup at the end, which results
in a segmentation fault.
Fix this by verifying the presence of the left operand at expression
compilation time.
Reported-by: Matthew Hughes <matthewhughes934@gmail.com>
Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-xml-encode.c')
0 files changed, 0 insertions, 0 deletions