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

raster/raster3d: Initialize Cell_head structure contents before using it in r3.in.lidar, r.in.lidar, r.in.pdal, r.in.xyz #4390

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

ymdatta
Copy link
Contributor

@ymdatta ymdatta commented Sep 25, 2024

If a structure is not initialized, it may contain random data. Avoid that by initializing it.

This was found using cppcheck tool.

@github-actions github-actions bot added C Related code is in C module raster3d labels Sep 25, 2024
@ymdatta ymdatta changed the title raster3d: Initialize Cell_head structure contents before using it raster3d: Initialize Cell_head structure contents before using it in r3.in.lidar Sep 25, 2024
raster3d/r3.in.lidar/main.c Outdated Show resolved Hide resolved
Copy link
Member

@wenzeslaus wenzeslaus left a comment

Choose a reason for hiding this comment

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

I smell some unused values here, so probably low risk, but this is adopted from the 2D version r.in.lidar which was also used for for r.in.pdal. r.in.lidar itself is based on r.in.xyz. So, maybe worth investigating all these at the same time.

@ymdatta ymdatta changed the title raster3d: Initialize Cell_head structure contents before using it in r3.in.lidar raster3d: Initialize Cell_head structure contents before using it in r3.in.lidar, r.in.lidar, r.in.pdal, r.in.xyz Sep 26, 2024
@ymdatta
Copy link
Contributor Author

ymdatta commented Sep 26, 2024

I see a lot of instances in raster/raster3d and other parts as well where this structure was used without initializing it. I think we should track it with low priority and clean it up.

@ymdatta ymdatta changed the title raster3d: Initialize Cell_head structure contents before using it in r3.in.lidar, r.in.lidar, r.in.pdal, r.in.xyz raster, raster3d: Initialize Cell_head structure contents before using it in r3.in.lidar, r.in.lidar, r.in.pdal, r.in.xyz Sep 26, 2024
@github-actions github-actions bot added raster Related to raster data processing C++ Related code is in C++ labels Sep 26, 2024
If a structure is not initialized, it may contain random data. Avoid
that by initializing it.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
@nilason nilason changed the title raster, raster3d: Initialize Cell_head structure contents before using it in r3.in.lidar, r.in.lidar, r.in.pdal, r.in.xyz raster/raster3d: Initialize Cell_head structure contents before using it in r3.in.lidar, r.in.lidar, r.in.pdal, r.in.xyz Oct 11, 2024
@nilason nilason added this to the 8.5.0 milestone Oct 11, 2024
@nilason nilason enabled auto-merge (squash) October 11, 2024 06:31
Copy link
Contributor

@nilason nilason left a comment

Choose a reason for hiding this comment

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

Thanks!

@nilason nilason merged commit 3a95b7a into OSGeo:main Oct 11, 2024
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C C++ Related code is in C++ module raster Related to raster data processing raster3d
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants