bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-readline] tgoto() test in rlfe randomly segfaults on 64bit systems


From: Mike Frysinger
Subject: [Bug-readline] tgoto() test in rlfe randomly segfaults on 64bit systems
Date: Fri, 30 Sep 2011 13:40:31 -0400
User-agent: KMail/1.13.7 (Linux/3.1.0-rc4; KDE/4.6.5; x86_64; ; )

in the rlfe subdir, there is this test:
        AC_TRY_RUN([
        main()
        {
         exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
        }], AC_NOTE(- you use the termcap database),
        AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO))

on 64bit systems (where sizeof(void*) == 8 and sizeof(int) == 4), this 
randomly segfaults.  it's a classic "implicit prototype defaults to an 
integer" problem where the pointer gets truncated.  so if the high 4 bytes 
have non-zero values, passing it to strcmp() results in a crash.

couple of ways to fix this ... not sure what people prefer:
 - do AC_CHECK_HEADERS(term.h) and then add before the main(), an optional 
term.h include
 - add before main(): extern char *tgoto(char *, ...);
-mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]