Author: sebor
Date: Tue Feb 21 18:44:31 2006
New Revision: 379657
URL: http://svn.apache.org/viewcvs?rev=379657&view=rev
Log:
2006-02-21 Martin Sebor <[EMAIL PROTECTED]>
* printf.cpp (rw_vasnprintf): Increased the size of the backtrack
array, increased the size of the cvtspec buffer after a successful
allocation, and asserted preconditions.
Modified:
incubator/stdcxx/trunk/tests/src/printf.cpp
Modified: incubator/stdcxx/trunk/tests/src/printf.cpp
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/src/printf.cpp?rev=379657&r1=379656&r2=379657&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/src/printf.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/printf.cpp Tue Feb 21 18:44:31 2006
@@ -837,7 +837,7 @@
FmtSpec *pspec = specbuf;
// local buffer for backtrack offsets implementing conditionals
- int backtrack [32];
+ int backtrack [64];
int nextoff = 0;
size_t default_bufsize = 1024;
@@ -891,6 +891,8 @@
}
else
goto fail;
+
+ spec_bufsize *= 2;
}
if ('{' == *fc) {
@@ -955,6 +957,7 @@
RW_ASSERT (0 < nextoff);
RW_ASSERT (0 == len);
+ RW_ASSERT (offinx < sizeof backtrack / sizeof *backtrack);
if (pspec [paramno].cond_true) {
// change from an inactive if to an active else
@@ -999,6 +1002,7 @@
if (!pspec [paramno].cond_true) {
// the end of an inactive clause
+ RW_ASSERT (offinx < sizeof backtrack / sizeof *backtrack);
RW_ASSERT (backtrack [offinx] <= int (buflen));
// set the length so as to backtrack to the position