You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2007/10/22 17:01:56 UTC
svn commit: r587122 - /incubator/stdcxx/trunk/tests/src/printf.cpp
Author: faridz
Date: Mon Oct 22 08:01:56 2007
New Revision: 587122
URL: http://svn.apache.org/viewvc?rev=587122&view=rev
Log:
2007-10-22 Farid Zaripov <fa...@epam.com>
Merged r587117 from branches/4.2.x with a fix for STDCXX-581
* printf.cpp (_rw_fmtstr): Provide reasonable length value
to call to __rw_memattr() to avoid touching uninitialized
memory.
(_rwfmtwstr): Ditto.
(_rwfmtarray): Ditto.
Modified:
incubator/stdcxx/trunk/tests/src/printf.cpp
Modified: incubator/stdcxx/trunk/tests/src/printf.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/src/printf.cpp?rev=587122&r1=587121&r2=587122&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/src/printf.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/printf.cpp Mon Oct 22 08:01:56 2007
@@ -1933,7 +1933,10 @@
{
RW_ASSERT (0 != buf.pbuf);
- if ( 0 == array || 0 > _RW::__rw_memattr (array, _RWSTD_SIZE_MAX, -1)
+ const size_t memlen = _RWSTD_SIZE_MAX == nelems
+ ? _RWSTD_SIZE_MAX : nelems * sizeof *array;
+ if ( 0 == array
+ || 0 > _RW::__rw_memattr (array, memlen, -1)
|| ((size_t)array & (sizeof *array - 1))) {
// qualify the name of the static function in order to
// allow it to be found when referenced from a template
@@ -2369,7 +2372,7 @@
if (spec.fl_pound)
return _rw_fmtarray (spec, buf, str, len, A_CHAR | A_ESC);
- if (0 == str || 0 > _RW::__rw_memattr (str, _RWSTD_SIZE_MAX, -1))
+ if (0 == str || 0 > _RW::__rw_memattr (str, len, -1))
return _rw_fmtbadaddr (spec, buf, str);
if (_RWSTD_SIZE_MAX == len)
@@ -2440,7 +2443,10 @@
return _rw_fmtarray (spec, buf, wstr, len, flags);
}
- if ( 0 == wstr || 0 > _RW::__rw_memattr (wstr, _RWSTD_SIZE_MAX, -1)
+ const size_t memlen = _RWSTD_SIZE_MAX == len
+ ? _RWSTD_SIZE_MAX : len * sizeof *wstr;
+ if ( 0 == wstr
+ || 0 > _RW::__rw_memattr (wstr, memlen, -1)
|| ((size_t)wstr & (sizeof *wstr - 1)))
return _rw_fmtbadaddr (spec, buf, wstr, sizeof *wstr);