[gdal-dev] "Banning" use of underflow/overflow with unsigned integer arithmetic ?

Even Rouault even.rouault at spatialys.com
Fri Aug 16 10:28:42 PDT 2019


Hi,

I've a PR ready that might be a bit controversial among contributors as it 
effectively "bans" a well-defined behaviour of C/C++, that is underflow/
overflow on unsigned integer arithmetic. However there are potential for real 
bugs to be hidden by such a behaviour (I or other contributors fixed a few 
instances of that in a few previous commits), so it seems reasonable to try to 
avoid it when possible, and when not possible, to tag the functions where this 
is explicitly allowed with CPL_NOSANITIZE_UNSIGNED_INT_OVERFLOW

See
https://github.com/OSGeo/gdal/pull/1782

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list