[netcdfgroup] Bug fix for byte and short variables larger than 4 GiB

Hi,

As first reported by Mario Emmenlauer, there is a bug in netCDF-3.6.2
(and earlier versions) in the code for creating byte and short type
variables greater than 4 GiB in size.

This problem resulted in an assertion violation or arithmetic exception
that would have caused a program to halt, rather than writing bad data
or corrupting existing data.

A fix is available as a patch to the file libsrc/var.c in the
netcdf-3.6.2 distribution from

  http://www.unidata.ucar.edu/software/netcdf/patches/large-vars-362-patch

The bug is also fixed in the latest snapshot release, available from:

  ftp://ftp.unidata.ucar.edu/pub/netcdf/snapshot/netcdf-daily.tar.gz

Here's a detailed description of the symptoms:  

1. On 32-bit platforms (with size_t an unsigned 32-bit type):

   * For a short variable, if the product of dimensions (not counting
     the record dimension, if any) is greater than 2**31 (that's
     2,147,483,648), the following assertion violation occurs:
     
       Assertion failed: remaining > 0, file putget.c, line 347

   * For any type of variable, if the product of dimensions (not
     counting the record dimension, if any) is exactly 2**32 (that's
     4,294,967,296) or any multiple of 2**32, an integer divide by zero
     occurs.

2. On 64-bit platforms (with size_t an unsigned 64-bit type):
     
   * For a byte variable, if the product of dimensions (not counting the
     record dimension, if any) is greater than 2**32, an assertion
     violation occurs:

       Assertion failed: *ulp <= X_SIZE_MAX, file ncx.c, line 1810

   * For a short variable, if the product of dimensions (not counting
     the record dimension, if any) is greater than 2**31, the same
     assertion violation occurs:

       Assertion failed: *ulp <= X_SIZE_MAX, file ncx.c, line 1810

The information in this email is also available on the web site "Known
Problems with the NetCDF Distributions" at

  http://www.unidata.ucar.edu/software/netcdf/docs/known_problems.html

--Russ
_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
russ@xxxxxxxxxxxxxxxx                     http://www.unidata.ucar.edu


  • 2008 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: