bug-gnulib
[Top][All Lists]
Advanced

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

Re: strstr in gnulib


From: Bruno Haible
Subject: Re: strstr in gnulib
Date: Mon, 8 Nov 2010 18:29:01 +0100
User-agent: KMail/1.9.9

Hello Dilyan,

> When I use the latest strstr implemenation from gnulib in git, the 
> following program crashes (causes Segmentation fault):
> 
> #include <string.h>
> #include <stdio.h>
> 
> void main() {
>    char *find = strstr ("**AB** **CD** **AB** **CD** **CD**", "**CD**");
>    printf("%s\n", find);
> }
> 
> It does not crash when I use strstr from libc-2.9 .

I cannot reproduce it.

$ cat foo.c
#include <string.h>
#include <stdio.h>

int main() {
   char *find = strstr ("**AB** **CD** **AB** **CD** **CD**", "**CD**");
   printf("%s\n", find);
   return 0;
}
$ gcc -Wall -O2 foo.c lib/strstr.c -I..
$ ./a.out
**CD** **AB** **CD** **CD**

Can you please give more details
  1) about your platform (CPU, 32-bit or 64-bit), gcc version, compilation
     flags,
  2) Show the stack trace that you get when you compile with -g and without
     optimization and then run gdb:
     $ gdb a.out
     (gdb) run
     (gdb) where

Bruno



reply via email to

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