I was wondering why the marked line in this function always gave "segmentation fault" error at the end of run. No warning at compiling, though.
Code:
void get_hashes(unsigned int hash[], const char *in)
{
int pos = strlen(in); //causing Segmentation fault at end of run!
hash[0] = RSHash(in, pos);
hash[1] = DJBHash(in, pos);
hash[2] = FNVHash(in, pos);
hash[3] = JSHash(in, pos);
hash[4] = PJWHash(in, pos);
hash[5] = SDBMHash(in, pos);
hash[6] = DEKHash(in, pos);
hash[7] = murmur(in, (uint64_t) pos, (uint64_t) pos);
}
And when I tried GDB to debug, the error message is:
Code:
Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/x86_64/strlen.S:106
106 ../sysdeps/x86_64/strlen.S: No such file or directory.
Can anybody help me with it?
Thanks a lot!