[Pkg-zsh-devel] Pointer trouble on 64-bit architectures due to implicit function declaration?

Axel Beckert abe at debian.org
Sun Feb 21 16:25:00 UTC 2016


Hi,

I just made a QA upload (of "filter") where fixing
https://qa.debian.org/bls/bytag/E-pointer-trouble-at-implicit.html
also fixed a segfault on amd64 (and probably most 64-bit
architectures), see https://bugs.debian.org/815438 

zsh is also listed as affected on the above page. So I wonder how much
impact this has on zsh. I can't remember any bug reports which look
like being caused by this. But having seen its implications in
real-life, I think we should at least a look at it.

So I'd be happy if those of us who are more C-savvy than I am (I'm
sure, at least Frank and Daniel have far more C knowledge than I do
:-) could have a look at it. If there's indeed something to fix, I
think it should be fixed upstream primarily. We can then cherry-pick
it if necessary.

Details about the issues found in zsh's build logs are at
https://qa.debian.org/bls/packages/z/zsh.html

Unfortunately "blhc" as available in Debian unstable does not emit
that warning as it seems to look only for hardening issues and not
this stuff. So you have to grep for it yourself in the build logs.

It looks like this on amd64 for zsh 5.2-3:

% fgrep -3 "Src/Modules/termcap.c:133" ../zsh_5.2-3_amd64.build
gcc -c -I. -I../../Src -I../../../Src -I../../../Src/Zle -I../../../Src/Modules -Wdate-time -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -g  -o stat.o ../../../Src/Modules/stat.c
gcc -c -I. -I../../Src -I../../../Src -I../../../Src/Zle -I../../../Src/Modules -Wdate-time -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -g  -o termcap.o ../../../Src/Modules/termcap.c
../../../Src/Modules/termcap.c: In function 'bin_echotc':
../../../Src/Modules/termcap.c:133:8: warning: implicit declaration of function 'tgoto' [-Wimplicit-function-declaration]
  tputs(tgoto(t, num, atoi(*argv)), 1, putraw);
        ^
../../../Src/Modules/termcap.c:133:8: warning: passing argument 1 of 'tputs' makes pointer from integer without a cast [-Wint-conversion]
In file included from ./../../Src/zsh.mdh:19:0,
                 from ./termcap.mdh:15,
                 from ../../../Src/Modules/termcap.c:38:
% fgrep -3 "Src/Zle/zle_refresh.c:2411" ../zsh_5.2-3_amd64.build
gcc -c -I. -I../../Src -I../../../Src -I../../../Src/Zle -I../../../Src/Zle -Wdate-time -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -g  -o zle_params.o ../../../Src/Zle/zle_params.c
gcc -c -I. -I../../Src -I../../../Src -I../../../Src/Zle -I../../../Src/Zle -Wdate-time -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -g  -o zle_refresh.o ../../../Src/Zle/zle_refresh.c
../../../Src/Zle/zle_refresh.c: In function 'tcoutarg':
../../../Src/Zle/zle_refresh.c:2411:14: warning: implicit declaration of function 'tgoto' [-Wimplicit-function-declaration]
     result = tgoto(tcstr[cap], arg, arg);
              ^
../../../Src/Zle/zle_refresh.c:2411:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     result = tgoto(tcstr[cap], arg, arg);
            ^
gcc -c -I. -I../../Src -I../../../Src -I../../../Src/Zle -I../../../Src/Zle -Wdate-time -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -g  -o zle_thingy.o ../../../Src/Zle/zle_thingy.c
% fgrep -3 "Src/prompt.c:1990" ../zsh_5.2-3_amd64.build
gcc -c -I. -I../Src -I../../Src -I../../Src/Zle -I../../Src -Wdate-time -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -g  -o pattern.o ../../Src/pattern.c
gcc -c -I. -I../Src -I../../Src -I../../Src/Zle -I../../Src -Wdate-time -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -g  -o prompt.o ../../Src/prompt.c
../../Src/prompt.c: In function 'set_colour_attribute':
../../Src/prompt.c:1990:9: warning: implicit declaration of function 'tgoto' [-Wimplicit-function-declaration]
   tputs(tgoto(tcstr[tc], colour, colour), 1, putstr);
         ^
../../Src/prompt.c:1990:9: warning: passing argument 1 of 'tputs' makes pointer from integer without a cast [-Wint-conversion]
In file included from ./zsh.mdh:19:0,
                 from ../../Src/prompt.c:30:
../../Src/prototypes.h:52:12: note: expected 'char *' but argument is of type 'int'
%

(Haven't checked 5.2-dev-1-1 yet.)

		Regards, Axel
-- 
 ,''`.  |  Axel Beckert <abe at debian.org>, http://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-    |  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE



More information about the Pkg-zsh-devel mailing list