lib/raster3d/tilewrite: Use >= for tile index bounds check - #7723
Conversation
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…/lib-raster3d-tilewrite.c
Add a pytest test covering the tileIndex bounds check in Rast3d_write_tile: an index equal to nTiles must be rejected as out of range, and the last valid index must be accepted. The invalid call runs in a subprocess using the grass.lib.raster3d ctypes bindings because the rejection is a fatal error which exits the calling process. The out-of-range test fails without the bounds check change in this branch and passes with it. The test was written by Claude Code using the Claude Fable 5 model.
|
Here is the Claude Code with Fable 5 review you asked for (I'm also adding a test): Review of PR #7723 — lib/raster3d/tilewrite: Use
|
The bounds check uses
>instead of>=for the upper bound. AtileIndexequal tomap->nTilesis out of range (valid indices are0tomap->nTiles - 1), so this condition should use>= map->nTilesto correctly reject that value.