Skip to content

Commit

Permalink
IntersectionMatrix: Ignore patterns longer than 9 characters
Browse files Browse the repository at this point in the history
Fixes #1084
  • Loading branch information
dbaston committed Apr 30, 2024
1 parent fcaebfc commit 02ea4ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/geom/IntersectionMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ IntersectionMatrix::set(Location row, Location col, int dimensionValue)
void
IntersectionMatrix::set(const std::string& dimensionSymbols)
{
auto limit = dimensionSymbols.length();
auto limit = std::min(dimensionSymbols.length(), 9ul);

for(std::size_t i = 0; i < limit; i++) {
auto row = i / firstDim;
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/capi/GEOSRelatePatternMatchTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,18 @@ void object::test<5>
ensure_equals(ret, char(0));
}

// invalid DE-9IM argument
// https://github.com/libgeos/geos/issues/1084
template<>
template<>
void object::test<6>
()
{
const char* mat = "0000000000";
ensure_equals(strlen(mat), 10u); // not a valid DE-9IM!

GEOSRelatePatternMatch(mat, "111111111");
}

} // namespace tut

0 comments on commit 02ea4ff

Please sign in to comment.