On Tue, May 31, 2016, at 22:05, Tito wrote:
(gdb) backtrace
#0 0x40104368 in malloc_consolidate () from /lib/libc.so.6
#1 0x40106218 in _int_malloc () from /lib/libc.so.6
#2 0x40107878 in malloc () from /lib/libc.so.6
#3 0x00033d00 in nmalloc (howmuch=1920) at utils.c:388
#4 0x00037508 in display_string (buf=0xc9300 "pippo", start_col=0,
len=62, dollars=false) at winio.c:1777
#5 0x000283a0 in not_found_msg (str=0xc9300 "pippo") at search.c:93
#6 0x00028dc0 in findnextstr (whole_word_only=false, begin=0xc9c48,
begin_x=0, needle=0xc9300 "pippo", needle_len=0x0)
at search.c:333
#7 0x00029178 in do_search () at search.c:456
Okay. When you comment out the call of not_found_msg() at line 333
it will most likely just abort on the next malloc. Something seems to
have messed up memory.
To exclude the possiblity that strncmp() is not working right on your
platform, can you compile and run the following small C program:
#include <string.h>
#include <stdio.h>
int main()
{
printf("Four... %x\n", strncmp("same", "sa", 4));
printf("Much... %x\n", strncmp("same", "sa", 12345));
printf("Sizet... %x\n", strncmp("same", "sa", (size_t)-1));
printf("Minus... %x\n", strncmp("same", "sa", -1));
}
Running ./a.out here produces:
Four... 1
Much... 1
Sizet... 1
Minus... 1