stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Travis Vitek" <>
Subject RE: svn commit: r647908 - in /stdcxx/trunk/tests: self/0.printf.cpp src/fmt_defs.h src/printf.cpp
Date Tue, 15 Apr 2008 01:36:06 GMT

Travis Vitek wrote:
>Unless I'm totally misunderstanding you (it seems that I may be), this
>would limit maximum command line length to 256 characters.

Okay, I think I'm finally seeing the light. My understanding of how this
was intended to work was totally wrong. I had mistakenly thought that if
the maxsize format specifier (%{*} or %{n}) wasn't provided that
rw_vasnprintf() would intellegently switch to a dynamic buffer and leave
the original user provided buffer alone.

I now understand that if the caller uses a static buffer, they are
expected (required) to indicate maximum number of characters to be
written to the buffer using the previously mentioned format specifier.
With that specifier, maxsize would get set and the guard check and
free() call are avoided. The guard bytes that were added in
[r351515|] will
usually detect that a buffer was not allocated with a previous call to
_rw_bufcat(), and the assertion will trigger. Unfortunately there wasn't
a comment there to indicate that this was expected behavior and that the
caller was using the function improperly.

So after a whole day of this I think I have the appropriate solution. It
is consistent with what Martin did in r351515, so I have that much going
for me. I'm planning on committing the fix shortly.


View raw message