[GRASS-git] [OSGeo/grass] 32785c: CQ: Fix CodeQL issues "Incorrect return-value chec...
Edouard Choinière
noreply at github.com
Mon Jul 13 06:26:12 PDT 2026
Branch: refs/heads/main
Home: https://github.com/OSGeo/grass
Commit: 32785cd092089a58c9ab0fce28aeaa85066a4ee1
https://github.com/OSGeo/grass/commit/32785cd092089a58c9ab0fce28aeaa85066a4ee1
Author: Edouard Choinière <27212526+echoix at users.noreply.github.com>
Date: 2026-07-13 (Mon, 13 Jul 2026)
Changed paths:
M general/g.region/main.c
M raster/r.out.vtk/writeascii.c
M raster/r.watershed/seg/init_vars.c
M raster3d/r3.out.vtk/writeVTKData.c
Log Message:
-----------
CQ: Fix CodeQL issues "Incorrect return-value check for a 'scanf'-like function" (#7673)
Follow-up from https://github.com/OSGeo/grass/pull/7660
This PR applies the same logic as the other PR, where how sscanf can also return EOF "if input failure occurs before the first receiving argument was assigned". (See https://en.cppreference.com/c/io/fscanf).
Here, the little touch that is different for `raster/r.out.vtk/writeascii.c` and `raster3d/r3.out.vtk/writeVTKData.c`, is that I assume that if there's the `EOF` case, or any invalid case for the `null_value`, we would still want the null value to be 0. I think that's the design intention behind the code.
This was assisted by AI (Copilot-generated fix suggestions for code scanning alerts), but we can reason through it and I applied some myself in order to batch them in one single PR.
This should fix:
- https://github.com/OSGeo/grass/security/code-scanning/525
- https://github.com/OSGeo/grass/security/code-scanning/526
- https://github.com/OSGeo/grass/security/code-scanning/527
- https://github.com/OSGeo/grass/security/code-scanning/528
- https://github.com/OSGeo/grass/security/code-scanning/531
- https://github.com/OSGeo/grass/security/code-scanning/532
- https://github.com/OSGeo/grass/security/code-scanning/533
* Potential fix for code scanning alert no. 525: Incorrect return-value check for a 'scanf'-like function
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* Potential fix for code scanning alert no. 528: Incorrect return-value check for a 'scanf'-like function
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* Update writeascii.c
* r3.out.vtk: Fix "Incorrect return-value check for a 'scanf'-like function" for null value
* r.watershed: Fix "Incorrect return-value check for a 'scanf'-like function" for disturbed_land default value
Adresses https://github.com/OSGeo/grass/security/code-scanning/532
---------
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications
More information about the grass-commit
mailing list