Skip to content

Commit 35a02b7

Browse files
authored
[extensions][wkb] Fix risk of undefined behavior when parsing a byte_order byte
* fixed risk of undefined behavior when parsing a byte_order byte tried to parse a spatialite WKB blob with this code but the byte_order byte was replaced by a '69' token : parsing this byte is successful but the value read is not part of the enum, the function returns true but the order parameter is left untouched. Calls to that function elsewhere in the code do not initialise the order parameter. see https://github.com/boostorg/geometry/blob/869e72fc01f2fce5ec3bcdfb91afab65ebd3ec6f/include/boost/geometry/extensions/multi/gis/io/wkb/detail/parser.hpp#L83 another option would be to return false in that case, but it didn't fit my need * Update parser.hpp typo fix
1 parent 40aff06 commit 35a02b7

File tree

1 file changed

+2
-0
lines changed
  • include/boost/geometry/extensions/gis/io/wkb/detail

1 file changed

+2
-0
lines changed

include/boost/geometry/extensions/gis/io/wkb/detail/parser.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ struct byte_order_parser
116116
if (byte_order_type::unknown > value)
117117
{
118118
order = byte_order_type::enum_t(value);
119+
}else{
120+
order = byte_order_type::unknown;
119121
}
120122
return true;
121123
}

0 commit comments

Comments
 (0)