[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 19990711: extra header space



>To: address@hidden
>From: Michael Nolta <address@hidden>
>Subject: extra header space
>Organization: Princeton
>Keywords: 199907110517.XAA12464 netCDF

Michael,

At the end of last week, I sent you a patch to the libsrc/nc.c in
netCDF 3.4.  I have just discovered a problem with this patch, at
least in netCDF 3.5, so I thought I ought to warn you to consider not
using it until I can fix this problem.

In case you want to know the details, the patch fails in at least the
following circumstance, with the symptom that adding a new record
variable can corrupt the data in other record variables:

 Open an existing netCDF file, rewrite a global attribute that has
 many values (e.g. a long string) with a smaller list of values
 (e.g. a shorter string), using nc_put_att_text() in data mode.  Close
 the file, which now has extra space in the header.  Reopen the file
 and enter define mode by calling nc_redef().  Add a new record
 variable with name and list of dimensions that fits within the extra
 header space.  Close the file.  Now old record variable data may be
 corrupted from writing the new record data fill values in the wrong
 locations, because the new record variable offset is calculated
 incorrectly.

I have a test program that demonstrates this problem and will fix it
as soon as possible, but in the meantime, I suggest you not trust data
files written by programs compiled with the patched version of 3.4,
unless you check them carefully for an occurrence of something like
the above bug.

--Russ