Bugfix: Also clear the command parser’s stack upon invalid commands (Thanks helgikrs)
Fixes: #652
This commit is contained in:
parent
607ba6fcde
commit
2abfb5a88b
|
@ -91,7 +91,9 @@ static void push_string(const char *identifier, char *str) {
|
|||
/* When we arrive here, the stack is full. This should not happen and
|
||||
* means there’s either a bug in this parser or the specification
|
||||
* contains a command with more than 10 identified tokens. */
|
||||
printf("argh! stack full\n");
|
||||
fprintf(stderr, "BUG: commands_parser stack full. This means either a bug "
|
||||
"in the code, or a new command which contains more than "
|
||||
"10 identified tokens.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -392,6 +394,7 @@ struct CommandResult *parse_command(const char *input) {
|
|||
|
||||
free(position);
|
||||
free(errormessage);
|
||||
clear_stack();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,4 +54,13 @@ ok(($unused ~~ @{get_workspace_names()}), 'workspace exists after moving');
|
|||
|
||||
# TODO: need a non-invasive command before implementing a test which uses ','
|
||||
|
||||
################################################################################
|
||||
# regression test: 10 invalid commands should not crash i3 (10 is the stack
|
||||
# depth)
|
||||
################################################################################
|
||||
|
||||
cmd 'move gibberish' for (0 .. 10);
|
||||
|
||||
does_i3_live;
|
||||
|
||||
done_testing;
|
||||
|
|
Loading…
Reference in New Issue