Help? seg-fault...

Dustin Sallings dustin at spy.net
Tue Jul 1 21:20:27 UTC 2008


On Jul 1, 2008, at 13:35, Michael Wieher wrote:

> It is a guarantee that "code" is never more than 8 characters,

	That's not a guarantee.  snprintf is a guarantee.

> file
> ranges from 2-digits to 3, max, and location wouldn't ever be more
> than 10 characters.  So, I'm looking at a string of max 21 chars, I
> made it 32.
>
> These inputs come from controlled static sources, not user input.
> However I did recompile w/asserts and they passed w/o issues.

	I can't say for sure what's going on in your code without seeing it  
as a whole, but these kinds of things are smells.  Any place you  
assume something, just stick an assertion in the code to both document  
and enforce it.  Makes it a lot harder to write bugs.

>> You seem to be missing symbols from the valgrind output.  Perhaps  
>> you should
>> compile the debugging symbols in.
>
> I know.  It's a bit of a strange situation, in that I'm actually
> compiling a shared-library.so file that is imported into and run by
> Python, but the compilation itself of the C++ library is done with -g
> ... so I'm at a bit of a loss as how to get a different angle on it,
> without basically writing a wrapper-driver to compile & test the
> sucker at the C/C++ level, before then wrapping it into Python.

	Yeah, definitely test the parts in the most simple way possible.   
You've got a really simple error somewhere.  The less code you have to  
look at, the easier it'll be to find.

	See also:  The Underhaded C Contest.  :)

-- 
Dustin Sallings



More information about the memcached mailing list