Skip to content

Commit 3ed568f

Browse files
committed
Print start of offending string in overlong string exception
Fixes #358
1 parent 5663f77 commit 3ed568f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

include/osmium/io/detail/pbf_decoder.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ namespace osmium {
165165
while (pbf_string_table.next(OSMFormat::StringTable::repeated_bytes_s, protozero::pbf_wire_type::length_delimited)) {
166166
const auto str_view = pbf_string_table.get_view();
167167
if (str_view.size() > osmium::max_osm_string_length) {
168-
throw osmium::pbf_error{"overlong string in string table"};
168+
const std::string start_of_string(str_view.data(), 20);
169+
throw osmium::pbf_error{"overlong string (" + start_of_string + "...) in string table"};
169170
}
170171
m_stringtable.emplace_back(str_view.data(), osmium::string_size_type(str_view.size()));
171172
}

0 commit comments

Comments
 (0)