Skip to content

Commit a4a57b1

Browse files
committed
Bugfix: Access beyond end of buffer in OPL parser
Thanks to mmd for finding and fixing this bug. See #330.
1 parent 4dd1f9a commit a4a57b1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/osmium/io/detail/o5m_input_format.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ namespace osmium {
345345
const char* decode_info(osmium::OSMObject& object, const char** dataptr, const char* const end) {
346346
const char* user = "";
347347

348+
if (*dataptr == end) {
349+
throw o5m_error{"premature end of file while parsing object metadata"};
350+
}
351+
348352
if (**dataptr == 0x00) { // no info section
349353
++*dataptr;
350354
} else { // has info section

0 commit comments

Comments
 (0)