Commit Graph

392 Commits

Author SHA1 Message Date
Ward Fisher
9e926410ee Added the fix suggested by @mathstuf in support of https://github.com/unidata/netcdf-c/issues/845 2018-02-07 11:23:54 -07:00
Ward Fisher
0d420fcfbb
Merge branch 'master' into cdf5_var_len 2018-02-02 10:31:46 -07:00
Ward Fisher
27693ba4a3
Merge branch 'master' into nc3-per-var-fill-v2 2018-02-01 11:45:40 -07:00
Ward Fisher
8487a0a954
Merge branch 'master' into cdf5_var_len 2018-01-25 16:30:58 -07:00
Ed Hartnett
2197d9849b merged 466 2018-01-20 06:04:08 -07:00
Wei-keng Liao
0f4a85b9f2 a clean commit for #383 2017-12-20 20:53:30 -06:00
Ed Hartnett
46d3bca8f4 removed non-working BUILD_DLL target 2017-11-30 05:40:17 -07:00
Ed Hartnett
bcfce160fb fixed warning 2017-11-30 04:56:46 -07:00
Ed Hartnett
3c5404ccf7
Merge branch 'master' into ejh_ncfunc_testing 2017-11-28 00:04:38 +00:00
Nehal J Wani
1b91bd89d4
Fix build on pre-C99 compilers
- Make sure that the variables are declared at the top of the block.
 - Add fix to enable inline for various compilers
2017-11-26 01:47:54 +05:30
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
Wei-keng Liao
294c734f64 add NC_check_voffs() to check whether the file starting offsets (begin) of all variables follows the same increasing order as they were defined. 2017-09-15 14:48:53 -05:00
Wei-keng Liao
b07d9701a9 move detection of NC_EVARSIZE from nc_enddef to nc_def_var 2017-09-13 11:57:19 -05:00
Wei-keng Liao
a414fc9af8 For record variables: throw NC_EVARSIZE when detecting a variable larger then X_INT64_MAX - 3 for CDF-5 files 2017-09-13 11:39:38 -05:00
Wei-keng Liao
8b3d32ca1e throw NC_EVARSIZE when detecting a variable larger then X_INT64_MAX - 3 for CDF-5 files 2017-09-13 00:41:04 -05:00
Wei-keng Liao
49226bb76b remove checking against UINT32_MAX 2017-09-11 19:13:13 -05:00
Wei-keng Liao
752f31a3d3 add handling for writing vsize to header for large variable sizes, following the CDF format specification 2017-09-07 16:56:42 -05:00
Wei-keng Liao
8c5956946a fix the setting of the member len of NC_var object, related to issue 463 2017-09-06 19:49:59 -05: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
64af659fae fix vpath build for regenerating c files from m4 files 2017-08-20 13:53:25 -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