-
Notifications
You must be signed in to change notification settings - Fork 365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined behavior in OverlayMixedPoints.cpp #931
Milestone
Comments
I think you can clear the issue with the following. The self tests pass, and there are no UBsan findings. diff --git a/src/operation/overlayng/OverlayMixedPoints.cpp b/src/operation/overlayng/OverlayMixedPoints.cpp
index b0a20a91..100a7229 100644
--- a/src/operation/overlayng/OverlayMixedPoints.cpp
+++ b/src/operation/overlayng/OverlayMixedPoints.cpp
@@ -277,7 +277,7 @@ OverlayMixedPoints::extractCoordinates(const Geometry* points, const PrecisionMo
auto coords = detail::make_unique<CoordinateSequence>(0u, points->hasZ(), points->hasM());
coords->reserve(points->getNumPoints());
- CoordinateExtractingFilter filter(*coords, *p_pm);
+ CoordinateExtractingFilter filter(*coords, p_pm ? *p_pm : PrecisionModel());
points->apply_ro(&filter);
return coords;
} |
Does this one work as well? diff --git a/src/operation/overlayng/OverlayMixedPoints.cpp b/src/operation/overlayng/OverlayMixedPoints.cpp
index b0a20a91a..1285186a2 100644
--- a/src/operation/overlayng/OverlayMixedPoints.cpp
+++ b/src/operation/overlayng/OverlayMixedPoints.cpp
@@ -76,7 +76,7 @@ private:
/*public*/
OverlayMixedPoints::OverlayMixedPoints(int p_opCode, const Geometry* geom0, const Geometry* geom1, const PrecisionModel* p_pm)
: opCode(p_opCode)
- , pm(p_pm)
+ , pm(p_pm ? p_pm : geom0->getPrecisionModel())
, geometryFactory(geom0->getFactory())
, resultDim(OverlayUtil::resultDimension(opCode, geom0->getDimension(), geom1->getDimension()))
{ |
Yes, that tested Ok. No runtime errors, and all self tests passed. |
Wonderful! Thank you very much for the helpful report! |
pramsey
added a commit
that referenced
this issue
Jun 28, 2023
pramsey
added a commit
that referenced
this issue
Jun 28, 2023
pramsey
added a commit
that referenced
this issue
Jun 28, 2023
pramsey
added a commit
that referenced
this issue
Jun 28, 2023
pramsey
added a commit
that referenced
this issue
Jun 28, 2023
pramsey
added a commit
that referenced
this issue
Jun 28, 2023
pramsey
added a commit
that referenced
this issue
Jun 28, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Everyone,
I think
OverlayMixedPoints.cpp
may have a touch of undefined behavior. The Undefined Behavior Sanitizer (UBsan) is triggering on lineOverlayMixedPoints.cpp:280
.Here are the steps I used to tickle the UB.
The text was updated successfully, but these errors were encountered: