Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Warnings in compctl



On 23 Mar, Jun T wrote:
> Three more files (complete.c, computil.c, zle_thingy.c) have the same
> "off the front" pointer assignments; these are detected by
> "clang -Warray-bounds-pointer-arithmetic".

One of these changes now triggers stack-use-after-scope in the address
sanitizer because skip_this_arg is declared inside the while loop but is
accessed in the while loop's condition.

Oliver

diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index 5601c1178..6b892b822 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -725,13 +725,13 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
 	remetafy = 0;
 
     while (*args && **args == '-') {
+	char skip_this_arg[2] = "x";
 	char *num;
 	if (!args[0][1] || args[0][1] == '-') {
 	    args++;
 	    break;
 	}
 	while (*++(*args)) {
-	    char skip_this_arg[2] = "x";
 	    switch (**args) {
 	    case 'n':
 		num = args[0][1] ? args[0]+1 : args[1];



Messages sorted by: Reverse Date, Date, Thread, Author