Re: segv at strcmp

From: Jeff Woods <kazrak+kernel_at_cesmail.net>
Date: 2003-12-25 10:44:15
At 12/24/2003 03:13 PM -0800, umut aymakoglu wrote:
>The segv happens at memcmp() at a line like: 'strcmp(x, "this is 24 chars 
>long")' where x is a char pointer with a length of 7 and the constant has 
>a length of 24. x is located at the first 8 bytes of the last 16 bytes at 
>the end of a non-contiguous shared memory segment. memcmp() segvs when it 
>tries to load 8 bytes from the "r19" register which initially has the 
>address of x and points to the end of the segment when the segv happens.

So are you calling strcmp() or memcmp() ?  If you are calling strcmp(), it 
sounds like the "last 16 bytes" are not null-terminated to be a valid 
string and the strcmp() is running off the end of the memory segment which 
causes it to try address memory to which it doesn't have access.  If you're 
calling memcmp() with a length longer than 16 then it is also running off 
the end of the segment.

--
Jeff Woods <kazrak+kernel@cesmail.net> 


-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Dec 24 18:46:35 2003

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:21 EST