Opened 7 years ago

Closed 7 years ago

#11265 closed Bugs (fixed)

boost::algorithm::join produces incorrect results with char16_t

Reported by: dave.lowell@… Owned by: Marshall Clow
Milestone: To Be Determined Component: string_algo
Version: Boost 1.56.0 Severity: Problem
Keywords: Cc:

Description

Calling boost::algorithm::join on char16_t data silently produces corrupted results. This causes strings to have incorrect sizes. This appears to happen because char16_t is not recognized as a character literal type in boost/range/as_literal.hpp.

It does recognize wchar_t, so this problem is not visible where char16_t may be converted to wchar_t. I've observed the problem on gcc 4.7

I've attached a patched version of boost/range/as_literal.hpp and some reproduction code which demonstrates the issue.

The reproduction code creates the string "aa,bb" once using string concatenation and once using join. With concatenation, the size of the string is 5 as expected. With join, the size is 6.

Attachments (2)

as_literal_repro.cpp (434 bytes ) - added by dave.lowell@… 7 years ago.
reproduction code
as_literal.hpp (3.9 KB ) - added by dave.lowell@… 7 years ago.
patch

Download all attachments as: .zip

Change History (5)

by dave.lowell@…, 7 years ago

Attachment: as_literal_repro.cpp added

reproduction code

by dave.lowell@…, 7 years ago

Attachment: as_literal.hpp added

patch

comment:1 by Marshall Clow, 7 years ago

Status: newassigned

Thanks. I have reproduced this issue on Mac OS X using clang.

comment:2 by Marshall Clow, 7 years ago

comment:3 by Marshall Clow, 7 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.