Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Fix segfault resulting from an invalid geometry. #16409

Merged
merged 2 commits into from
Apr 17, 2020

Conversation

lseelenbinder
Copy link
Contributor

@lseelenbinder lseelenbinder commented Apr 16, 2020

Launch Checklist

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • apply needs changelog label if a changelog is needed (remove label when added)

The current implementation of SymbolLayout::addFeature can segfault on an invalid LineString (containing a Line with no members). This skips adding invalid geometries (i.e., LineStrings) when encountered.

This is a trivial bug to verify based on reading the code. I'm happy to add a test case, if someone can point me to the right place.

Copy link
Contributor

@pozdnyakov pozdnyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this! LGTM % nit

src/mbgl/layout/symbol_layout.cpp Show resolved Hide resolved
@tmpsantos
Copy link
Contributor

I kicked the CI bots. 🤖

@chloekraw
Copy link
Contributor

chloekraw commented Apr 22, 2020

@lseelenbinder thanks for catching this!

@tmpsantos @pozdnyakov where can @lseelenbinder add the test? Are there other invalid geometries that we should skip?

@tmpsantos
Copy link
Contributor

@lseelenbinder I merged before you could add a test for this PR. Do you have one?

@lseelenbinder
Copy link
Contributor Author

I don't, @tmpsantos. I wasn't sure where such a test should go in the testing apparatus. :)

@tmpsantos
Copy link
Contributor

@lseelenbinder it could be a unit test using gtest. They are inside /test

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants