Commit Graph

374 Commits

Author SHA1 Message Date
Ed Hartnett
845355e91b added hdf4 test for inq_format calls 2017-11-22 08:21:24 -07:00
Ed Hartnett
d4495e8e86 more testing 2017-11-22 07:46:03 -07:00
Ed Hartnett
70c739858b fixed SEGFAULT for NULL parameter for nc_inq_format(), added testing, improved documentation 2017-11-22 06:53:23 -07:00
Ward Fisher
e97911a592 Updated v1hpg.c to make header padding with null byte checks optional. 2017-11-20 16:08:06 -07:00
Ward Fisher
5e5dfc6f7b
Merge branch 'master' into O3_bug 2017-11-16 09:16:23 -07:00
Wei-keng Liao
9b511b4e0f fix codes might break strict-aliasing rules 2017-11-16 00:01:01 -06:00
Ed Hartnett
3b82328902
Merge branch 'master' into ejh_more_warnings 2017-11-15 03:41:12 -07:00
Ward Fisher
16d6f94f30 Merge branch 'master' into filters.dmh 2017-11-13 11:15:02 -07:00
Ed Hartnett
cfa773d29d used cast to int instead of %ul printf format, because some compilers are a little out of step 2017-11-09 10:44:46 -07:00
Ed Hartnett
0e0482bc05 fixed warnings 2017-11-09 06:24:18 -07:00
Ward Fisher
f98635be1b Merge remote-tracking branch 'origin/h5offset.dmh' into dmh_multi_merge 2017-11-03 12:40:52 -06:00
Ward Fisher
91865a3cbc Merge branch 'NC_MAX_VAR_DIMS' of https://github.com/wkliao/netcdf-c into multi-merge 2017-11-02 11:20:54 -06:00
Ward Fisher
d7f0919c12
Merge branch 'master' into NC_MAX_VAR_DIMS 2017-10-31 14:06:41 -06:00
Ward Fisher
2987fb0bed
Merge branch 'master' into master 2017-10-31 14:01:08 -06:00
Ward Fisher
178ed4aa98 Merge branch 'typedef_schar' of https://github.com/wkliao/netcdf-c into ejh_more_merges 2017-10-26 14:35:57 -06:00
Ward Fisher
bacdef88fe Merge branch 'master' into NC_MAX_VAR_DIMS 2017-10-26 14:31:22 -06:00
Ed Hartnett
ca9a5d4133 fixed warning 2017-10-25 06:30:47 -06:00
Dennis Heimbigner
9983b9d911 re e-support UBS-599337
re pull request https://github.com/Unidata/netcdf-c/pull/405
re pull request https://github.com/Unidata/netcdf-c/pull/446

Notes:
1. This branch is a cleanup of the magic.dmh branch.
2. magic.dmh was originally merged, but caused problems with parallel IO.
   It was re-issued as pull request https://github.com/Unidata/netcdf-c/pull/446.
3. This branch + pull request replace any previous pull requests and magic.dmh branch.

Given an otherwise valid netCDF file that has a corrupted header,
the netcdf library currently crashes. Instead, it should return
NC_ENOTNC.

Additionally, the NC_check_file_type code does not do the
forward search required by hdf5 files. It currently only looks
at file position 0 instead of 512, 1024, 2048,... Also, it turns
out that the HDF4 magic number is assumed to always be at the
beginning of the file (unlike HDF5).
The change is localized to libdispatch/dfile.c See
https://support.hdfgroup.org/release4/doc/DSpec_html/DS.pdf

Also, it turns out that the code in NC_check_file_type is duplicated
(mostly) in the function libsrc4/nc4file.c#nc_check_for_hdf.

This branch does the following.
1. Make NC_check_file_type return NC_ENOTNC instead of crashing.
2. Remove nc_check_for_hdf and centralize all file format checking
   NC_check_file_type.
3. Add proper forward search for HDF5 files (but not HDF4 files)
   to look for the magic number at offsets of 0, 512, 1024...
4. Add test tst_hdf5_offset.sh. This tests that hdf5 files with
   an offset are properly recognized. It does so by prefixing
   a legal file with some number of zero bytes: 512, 1024, etc.
5. Off-topic: Added -N flag to ncdump to force a specific output dataset name.
2017-10-24 16:25:09 -06:00
Dennis Heimbigner
733da154c5 1. Keep up to date by merging master
2. Factored out the parameter string parsing for ncgen and nccopy
   int libdispatch/dfilter.c + include/ncfilter.h
3. Allow a parameter string to use constant types other than
   unsigned int. See docs/filters.md for details.
4. Moved the old content of  include/netcdf_filter.h into include/netcdf.h
   and removed include/netcdf_filter.h as no longer needed.
5. Force the test filter (bzip2) in nc_test4/filter_test to
   be built using BUILT_SOURCES.
2017-10-08 15:56:45 -06:00
Greg Sjaardema
9964cee7cd Merge branch 'master' into master 2017-09-26 11:06:04 -06:00
Wei-keng Liao
2cc30c16be check against NC_MAX_VAR_DIMS (but using NC_EMAXDIMS, maybe a new error code NC_EMAXVARDIMS is needed) 2017-09-21 12:37:33 -05:00
Ward Fisher
d2cdc4cb5a Working on getting cdf5 tests running. 2017-09-15 18:00:28 -06:00
Dennis Heimbigner
d8d4ed627a master merge 2017-08-29 18:05:46 -06:00
Dennis Heimbigner
ed44fd7306 Add szip support via libaec 2017-08-27 13:35:20 -06:00
Wei-keng Liao
8b6d131cbe Because ncx.c and putget.c are to be released with the package in case users do not have m4, the generation of the two C files cannot depend on the configure option of --enable-erange-fill. This commit fixes this problem by replacing m4 conditional define with C conditional preprocess. 2017-08-20 14:32:57 -05:00
Wei-keng Liao
2a68d58433 avoid calling NC3_inq_var_fill when ERANGE_FILL is enabled 2017-08-20 02:04:29 -05:00
Dennis Heimbigner
7e8bd784cc Merge branch 'master' into filters.dmh 2017-08-17 14:29:34 -06:00
Dennis Heimbigner
86fc8745dc merge master and resolve conflicts 2017-08-12 15:50:31 -06:00
Lars Pastewka
bd33076424 Fixed computation of recsize for NC_64BIT_DATA files. 2017-08-09 21:47:08 +02:00
Greg Sjaardema
1503013e33 Eliminate NC_MAX_VARS|DIMS|ATTRS limits 2017-07-20 09:32:29 -06:00
Dennis Heimbigner
715a6fe5eb The files libdispatch/dwinpath.c and include/ncwinpath.h
were added to provide a path name converter from e.g. cygwin
paths to e.g. windows paths. This is necessary because
the shell scripts may produce cygwin paths, but the code
may have been compiled with Visual Studio. Similar issues
arise with Mingw.

At appropriate places, and if using Visual Studio or Mingw,
I added calls to the path conversion code.
Apparently I forgot to find all the places where this
conversion was needed. So this pr does the following:
1. Push the calls to the converter to the various libXXX
   directories and out of libdispatch/dfile.c.
2. Add conversion calls to other parts of the code like oc2.

I also turns out that conversion code in dapcvt.c
had a bug when handling DAP Byte type under visual studio.

Notes:
1. there may still be places I missed that need to do path conversion.
2. need to make sure that calls to e.g. H5open also use converted path.
2017-07-13 10:40:07 -06:00
Even Rouault
4779c8278f Fix undefined left shift in get_ix_int()
Getting the value of the x variable on the file corresponding to the below ncdump output
with -fsanitize=undefined raises

ncx.c:1034:14: runtime error: left shift of 128 by 24 places cannot be represented in type 'int'

This is due to *cp being promoted to int before doing the left shift, instead
of the intended unsigned. So do the cast to unsigned internally rather than
externally

ncdump file to reproduce:

netcdf temp {
dimensions:
	x = 2 ;
	y = 2 ;
	v = 2 ;
variables:
	int x(v) ;
	byte y(y, x) ;
data:

 x = _, _ ;

 y =
  -127, -127,
  -127, -127 ;
}

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2356

Credit to OSS Fuzz
2017-06-23 12:16:53 +02:00
Even Rouault
b3418d2cd6 Fix undefined left shift in ncx_get_size_t()
Running a build on the .nc file corresponding to the below ncdump output
with -fsanitize=undefined raises

libsrc/ncx.c:4722:26: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

This is due to *cp being promoted to int before doing the left shift, instead
of the intended unsigned. So do the cast to unsigned internally rather than
externally

ncdump file to reproduce:

netcdf temp {
dimensions:
	y = UNLIMITED ; // (0 currently)
	x = 109067 ;
variables:
	byte t(y, x, x) ;
data:
}

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2265

Credit to OSS Fuzz
2017-06-15 12:46:37 +02:00
Ward Fisher
92270070d5 Merge branch 'nc_get_filelen' of https://github.com/wkliao/netcdf-c into v4.5.0-release-branch 2017-06-09 12:50:11 -06:00
Wei-keng Liao
308c2f764e struct stat.st_size is of type off_t 2017-06-09 02:51:06 -05:00
Wei-keng Liao
6b85d54d94 typedef schar to signed char 2017-06-08 23:55:25 -05:00
Ward Fisher
b73c81697c Removed a line in configure.ac that is potentially redundant and throws an error on some systems. In support of https://github.com/Unidata/netcdf-c/issues/413 2017-06-08 12:38:43 -06:00
Wei-keng Liao
29ae0b72fe X_INT64_MIN, X_INT64_MAX, and X_UINT64_MAX should be used internally 2017-06-06 18:20:26 -05:00
Ward Fisher
f4151c97f2 Reverted changes to X_get_size_t, in order to correct an issue 2017-05-31 09:40:59 -06:00
Dennis Heimbigner
c834d4af12 merge from master 2017-05-10 12:33:03 -06:00
Ward Fisher
051bd3b81a Merge branch 'master' into open_check_vlens 2017-05-05 17:02:36 -06:00
Dennis Heimbigner
6dc6cf65ba re: issue https://github.com/Unidata/netcdf-c/issues/401
It turns out that the chunksize used in the
ncio-related code must be a multiple of eight in
size.  Both memio.c and mmapio.c were
potentially violating this constraint.

See also pr https://github.com/Unidata/netcdf-c/pull/400
2017-05-02 21:22:54 -06:00
Dennis Heimbigner
7c3164577e Finalize the compression support.
This relies on the HDF5 capability to
dynamically load compression filters.
Note that a compression filter is just
a subcase of filters.

The primary user-visible changes are as follows:
1. Add a standard header "netcdf_filter.h" that defines
   the necessary API extensions
2. Modify ncgen to support two new special attributes
   "_Filter_ID" and "_Filter_Parameters" so that compression
   can be turned on when creating a file using ncgen.
4. Add a detailed description of filtering support
   to the user's guide; see the file filters.md
5. Add a test case directory for this: nc_test4/filter_test.
   It is fragile and a ./configure flags (-enable-filter-test)
   is defined (default disabled) to shut this off this test
   to avoid spurious 'make check' failures.

Note that the HDF5 documentation is not up-to-date, so
much of what is encoded here comes from examining the
actual code in the file H5PL.c in the HDF5 source code.
2017-04-27 13:01:59 -06:00
Ward Fisher
8dddd222a3 Merged master, DAP4 support into branch. 2017-04-19 09:29:35 -06:00
Ward Fisher
b5b99cbebb Merge branch 'master' into ghpull-375 2017-04-05 16:24:55 -06:00
Wei-keng Liao
68a57832d6 enable nc_open to check the number of large variables allowed in CDF-1 and CDF-2 files 2017-04-03 22:07:36 -05:00
Dennis Heimbigner
5f15c9e777 1) master merge 2)fix uname -o problem 2017-03-30 16:21:31 -06:00
Wei-keng Liao
73ccb364a9 To solve NC_ELATEFILL error for NetCDF-4 files, mark all variables written at enddef. 2017-03-24 20:55:00 -05:00
Ward Fisher
80d2b914a1 Updates for Visual-Studio-based builds. 2017-03-16 14:34:33 -06:00
Wei-keng Liao
08aef9af5d remove special treatments for arm architecture 2017-03-11 13:33:58 -06:00