Skip to content
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

Check for sweep_axis being an empty string in PJ_geos. #908

Merged
merged 2 commits into from Mar 27, 2018

Conversation

schwehr
Copy link
Member

@schwehr schwehr commented Mar 27, 2018

Found with autofuzz MemorySanitizer: use-of-uninitialized-value

\0 after sweep causes the failure:
+proj=geos +h=17892900000020003z + +sweep^@+

Found with autofuzz MemorySanitizer: use-of-uninitialized-value
src/PJ_geos.c Outdated
@@ -206,7 +206,8 @@ PJ *PROJECTION(geos) {
if (sweep_axis == NULL)
Q->flip_axis = 0;
else {
if (sweep_axis[1] != '\0' || (sweep_axis[0] != 'x' && sweep_axis[0] != 'y'))
if (sweep_axis[0] == '\0' || sweep_axis[1] != '\0' ||
Copy link
Member

Choose a reason for hiding this comment

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

more complicated that needed. You could just invert the 2 clauses of the original condition

if ((sweep_axis[0] != 'x' && sweep_axis[0] != 'y') || sweep_axis[1] != '\0')

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! I was thinking along the same lines after doing a patch that followed the local style. I was thinking about strnlen, but I prefer your suggestion.

@kbevers kbevers merged commit 28800e5 into OSGeo:master Mar 27, 2018
@kbevers kbevers added this to the 5.1.0 milestone Mar 27, 2018
@schwehr schwehr deleted the geos-sweep-b76441686 branch March 27, 2018 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants