Skip to content

utf8 to utf16 conversion must use native endianness #2533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jbmc/src/java_bytecode/java_string_literals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ symbol_exprt get_or_create_string_literal_symbol(
if(string_refinement_enabled)
{
const array_exprt data =
utf16_to_array(utf8_to_utf16_little_endian(id2string(value)));
utf16_to_array(utf8_to_utf16(id2string(value), false));

struct_exprt literal_init(new_symbol.type);
literal_init.operands().resize(jls_struct.components().size());
Expand Down
1 change: 1 addition & 0 deletions src/util/unicode.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ std::wstring widen(const std::string &s);

std::string utf32_to_utf8(const std::basic_string<unsigned int> &s);

std::wstring utf8_to_utf16(const std::string &in, bool swap_bytes);
std::wstring utf8_to_utf16_big_endian(const std::string &);
std::wstring utf8_to_utf16_little_endian(const std::string &);
std::string utf16_little_endian_to_java(const wchar_t ch);
Expand Down