Repository navigation
r.in.pdal: fix uncaught exception - #7887
Conversation
PointView::getFieldAs may throw exception. Second part of Coverity Scan CID 1685510
echoix
left a comment
There was a problem hiding this comment.
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.
Fix uncaught exception of PointView::getFieldAs.
Second part of Coverity Scan CID 1685510
(#7883 only fixed one part of the issue).