Debug mode output broken

Paolo Carlini pcarlini@suse.de
Fri Aug 6 16:43:00 GMT 2004


Paolo Carlini wrote:

> Jonathan, everything considered (simplicity, affecting only 
> !_GLIBCXX_USE_C99,
> code not performance critical since we are in debug mode, ...) I think 
> that, after all,
> your very first solution is the best one. If you don't hear other 
> comments during
> the next hours please apply it after due testing. Remember, however, 
> to add a comment,
> mentioning the special case of _M_print_string, and remove the 
> __attribute__((__unused__)),
> not needed anymore.

Actually, Jonathan, sorry but the patch is still not ok: in general it 
works fine but without
the equivalent of __n in snprintf, we are always at risk of overflowing 
__buf, since sprintf
stops only when it sees \0. A possible solution would be, as you said, 
enforcing strlen(__string)
< __bufsize but this limitation was not present in the original code and 
I don't like adding it.

We have to figure out something more involved, similar to your last 
proposal, I'm afraid.

Paolo.



More information about the Libstdc++ mailing list