This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Debug mode output broken


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]