stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r379657 - /incubator/stdcxx/trunk/tests/src/printf.cpp
Date Wed, 22 Feb 2006 02:44:35 GMT
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  <sebor@roguewave.com>

	* 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



Mime
View raw message