Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Fix crash in ca_parse_line
55208 reported a regression in 54889 which this fixes. It also fixes a
pre-existing bug that can be triggered by:
_arguments -s '-a:arg1:_files' '-b:*(\;)::rest:_normal'
Move the cont: label up a bit to include the section that initializes
endpat to fix the crash.
Out of the four "goto cont" in this function, the first and fourth have
state.def == NULL, which means the moved position of the label is a
no-op for them (both the if and the else if branch are conditional on
state.def). The second goto is the one that caused the crash in the
report, and the third one is the one that crashes with the _arguments
call above.
---
Src/Zle/computil.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 0a141ee81d..1aceed6935 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -2367,6 +2367,8 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
}
/* Do the end-pattern test if needed. */
+ cont:
+
if (state.def && state.curopt &&
(state.def->type == CAA_RREST || state.def->type == CAA_RARGS)) {
if (state.def->end)
@@ -2389,8 +2391,6 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
/* Copy the state into the global one. */
- cont:
-
if (cur + 1 == compcurrent) {
memcpy(&ca_laststate, &state, sizeof(state));
ca_laststate.ddef = NULL;
--
2.38.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author