[
https://issues.apache.org/jira/browse/STDCXX-857?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Travis Vitek updated STDCXX-857:
--------------------------------
Attachment: stdcxx-857.patch
I feel confident in this patch, but I don't want to risk breaking like I did
last weekend. I'm posting the patch for review, and I'll submit it Monday if
someone else doesn't do it first.
The simplification in {{_rw_bufcat()}} always allocates 4 guard bytes
regardless of the max length of the buffer. Unless I'm sorely mistaken, the max
length is intended to be the maximum number of characters allowed to be stored
in the buffer, not the maximum allocated size.
{noformat}
2008-04-11 Travis Vitek <[EMAIL PROTECTED]>
STDCXX-857
* tests/src/fmt_defs.h: Add flag to struct Buffer to indicate
who owns the allocated buffer.
* tests/src/printf.cpp (_rw_bufcat): Simplify logic to get
new buffer size. Avoid checking guard bytes and deallocating
buffer that we do not own and may not have guard bytes.
(rw_vasnprintf): Set flag indicating that the caller owns the
supplied buffer.
(_rw_fmtarray): Ditto.
(_rw_fmt_expr): Ditto.
{noformat}
> unexpected assertion from _rw_bufcat
> ------------------------------------
>
> Key: STDCXX-857
> URL: https://issues.apache.org/jira/browse/STDCXX-857
> Project: C++ Standard Library
> Issue Type: Bug
> Components: Test Driver
> Affects Versions: 4.2.1
> Reporter: Travis Vitek
> Assignee: Travis Vitek
> Fix For: 4.2.1
>
> Attachments: stdcxx-857.patch
>
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> Here is the assertion...
> {noformat}
> ..\..\..\tests\src\printf.cpp:486: char *__cdecl _rw_bufcat(struct Buffer
> &,const char *,unsigned int): Assertion '0 == memcmp (*buf.pbuf +
> *buf.pbufsize, guard, guardsize)' failed.
> {noformat}
> Here is a testcase...
> {noformat}
> #include <rw_printf.h>
> #include <string.h>
> #include <stdlib.h>
> int main (int argc, char* argv[])
> {
> const char* s = 1 < argc ? argv [1] : "bug-zapper";
> char buffer [4];
> char *buf = buffer;
> size_t bufsize = sizeof buffer;
> rw_asnprintf (&buf, &bufsize, "%s", s);
> if (buf != buffer)
> free (buf);
> return 0;
> }
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.