@@ -472,17 +472,22 @@ ok_error_t ResourcesParser::parse_string(LangCodeItem& lci, BinaryStream& stream
472472 /*
473473 * Read the value
474474 */
475- LIEF_DEBUG (" String.Value @0x{:x}" , stream.pos ());
476- if (auto res = stream.read_u16string ()) {
477- if (res->size () + /* null char */ 1 != wValueLength) {
478- LIEF_INFO (" String.Value.size() is different from wValueLength ({} / {})" ,
479- wValueLength, res->size () + 1 );
475+ if (wValueLength > 0 ) {
476+ LIEF_DEBUG (" String.Value @0x{:x}" , stream.pos ());
477+ if (auto res = stream.read_u16string ()) {
478+ if (res->size () + /* null char */ 1 != wValueLength) {
479+ LIEF_INFO (" String.Value.size() is different from wValueLength ({} / {})" ,
480+ wValueLength, res->size () + 1 );
481+ }
482+ value = res->c_str (); // To remove trailling \0
483+ std::string u8value = u16tou8 (value);
484+ LIEF_DEBUG (" {}: {}" , u8szKey, u8value);
485+ lci.items_ .emplace (szKey, value);
486+ stream.align (sizeof (uint32_t ));
480487 }
481- value = res->c_str (); // To remove trailling \0
482- std::string u8value = u16tou8 (value);
483- LIEF_DEBUG (" {}: {}" , u8szKey, u8value);
484- lci.items_ .emplace (szKey, value);
485- stream.align (sizeof (uint32_t ));
488+ } else {
489+
490+ lci.items_ .emplace (szKey, std::u16string ());
486491 }
487492 } else {
488493 LIEF_ERR (" Can't read String.szKey" );
0 commit comments