Fixed a bug in wstring_convert concerning zero-length inputs. Thanks to Jonathan Coxhead for reporting this bug.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160136 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2012-07-12 18:07:41 +00:00
parent 591e32d624
commit 1ca23672a0
3 changed files with 8 additions and 2 deletions

View File

@@ -3920,7 +3920,8 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
if (__cvtptr_ != nullptr)
{
wide_string __ws(2*(__frm_end - __frm), _Elem());
__ws.resize(__ws.capacity());
if (__frm != __frm_end)
__ws.resize(__ws.capacity());
codecvt_base::result __r = codecvt_base::ok;
state_type __st = __cvtstate_;
if (__frm != __frm_end)
@@ -3980,7 +3981,8 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
if (__cvtptr_ != nullptr)
{
byte_string __bs(2*(__frm_end - __frm), char());
__bs.resize(__bs.capacity());
if (__frm != __frm_end)
__bs.resize(__bs.capacity());
codecvt_base::result __r = codecvt_base::ok;
state_type __st = __cvtstate_;
if (__frm != __frm_end)