[GRASS-git] [OSGeo/grass] ec2bc8: r3.in.v5d: Prevent integer overflow by changing li...

Mohan Yelugoti noreply at github.com
Tue Oct 15 08:35:33 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: ec2bc8a7df27b1984c878b7a0a209bad9e977acd
      https://github.com/OSGeo/grass/commit/ec2bc8a7df27b1984c878b7a0a209bad9e977acd
  Author: Mohan Yelugoti <ymdatta.work at gmail.com>
  Date:   2024-10-15 (Tue, 15 Oct 2024)

  Changed paths:
    M raster3d/r3.in.v5d/binio.c

  Log Message:
  -----------
  r3.in.v5d: Prevent integer overflow by changing literal constant type on Cray (#4363)

When the code is being compiled for CRAY HPC machines, a macro and
a function to convert IEEE single precision floating point number
to CRAY number are defined.

To adjust the base, '16258' constant is being used, which according
to C rules (C99, section 6.4.4.1, subsection semantics) fits into
an integer. Right shifting that integer, which is of 32 bits, by
48 results in integer overflow. Avoid this by defining the
literal constant with the long data type.

This comes with an extended discussion in PR #4363 and an idea to remove the code completely.

Signed-off-by: Mohan Yelugoti <ymdatta.work at gmail.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