Skip to content

r.in.pdal: fix uncaught exception - #7887

Merged
nilason merged 1 commit into
OSGeo:mainfrom
nilason:fix_r_in_pdal2
Sep 6, 2026
Merged

nilason merged 1 commit into
OSGeo:mainfrom
nilason:fix_r_in_pdal2

Conversation

@nilason

@nilason nilason commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Fix uncaught exception of PointView::getFieldAs.

Second part of Coverity Scan CID 1685510

(#7883 only fixed one part of the issue).

PointView::getFieldAs may throw exception.

Second part of Coverity Scan CID 1685510
@nilason
nilason requested a review from petrasovaa September 5, 2026 13:23
@github-actions github-actions Bot added raster Related to raster data processing C++ Related code is in C++ module labels Sep 5, 2026

@echoix echoix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pure code move, AI review only finds pre-existing behaviour that I don't judge it is worth it

Details

Reviewed PR 7887 (r.in.pdal: fix uncaught exception), a single-file, pure code-motion change in raster/r.in.pdal/info.cpp: the min/max scan over the reprojected point view is moved inside the existing try block so that pdal::PointView::getFieldAs exceptions are caught and turned into G_fatal_error instead of escaping as an uncaught exception.

The move itself is correct: the loop only reads reprojected values, no state is needed after the try, G_fatal_error is noreturn so partially-updated outputs are never observed, and no other control flow or caller (get_extent at line 94) is affected. The only cost is that the catch message ("Reprojection of the data extent failed") now also covers field-read failures, which is acceptable.

Findings (1):

  • raster/r.in.pdal/info.cpp:187 — If the reprojected view is empty (PDAL's reprojection filter drops points it cannot transform rather than throwing), the loop never runs and the function silently returns the unchanged source-CRS extent as though it were reprojected; a post-execute() size check would surface this. Pre-existing behavior, but it now sits on the moved lines.

@nilason
nilason merged commit 6131e37 into OSGeo:main Sep 6, 2026
26 checks passed
@github-actions github-actions Bot added this to the 8.6.0 milestone Sep 6, 2026
@nilason
nilason deleted the fix_r_in_pdal2 branch September 7, 2026 07:07
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++ module raster Related to raster data processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants