Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#11915 closed Bugs (fixed)

Bug in xml_iarchive_impl<Archive>::load(std::wstring &ws)

Reported by: anonymous Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.61.0 Severity: Problem
Keywords: Cc:

Description

There is a problem when serialization calls

xml_iarchive_impl<Archive>::load(wchar_t * ws)

or

xml_iarchive_impl<Archive>::load(std::wstring &ws)

in Visual Studio VC 2010.

When std::mbrtowc is called in this function needs that "std::mbstate_t mbs" must be initialized to "std::mbstate_t()" in its first loop. Current value is undefined in this platform because mbstate_t is only an int (typedef int mbstate_t). It should be initialized before you use.

My proposed fix should be:

std::mbstate_t mbs = std::mbstate_t();

Change History (3)

comment:1 by Robert Ramey, 7 years ago

Looks good.

I can't test vc 2010 - have you made this change and verified that that it addresses the problem?

comment:2 by Robert Ramey, 7 years ago

Resolution: fixed
Status: newclosed

comment:3 by anonymous, 7 years ago

I've seen your commit https://github.com/boostorg/serialization/commit/6facb61510c845f2e926e6a6dc4a50e068a5792b?diff=unified

I tried this commit and to me is enough.

Although, I think this function

xml_iarchive_impl<Archive>::load(wchar_t * ws)

needs the same patch in line 101.

Note: See TracTickets for help on using tickets.