Commit Graph

510 Commits

Author SHA1 Message Date
Ed Hartnett
7cd344f7b0 removed redundant check in NC4_def_var() 2017-12-02 07:23:23 -07:00
Ed Hartnett
6c3aa79684 more testing of nc_set_var_chunk_cache_ints 2017-12-02 07:15:19 -07:00
Ed Hartnett
acbd3e259e more tests 2017-12-01 13:58:13 -07:00
Ed Hartnett
a8e9c196e2 more tests, fixed documentation warnings 2017-12-01 13:02:59 -07:00
Ed Hartnett
42c482d33c more tests 2017-12-01 11:20:09 -07:00
Ed Hartnett
3e45557157 more docs, more tests, eliminated two unneeded functions 2017-12-01 10:02:40 -07:00
Ed Hartnett
2023ed6b7c fixed problems with bad inputs to nc_def_Var 2017-12-01 09:08:12 -07:00
Ed Hartnett
5d11415b83 adding internal documentation 2017-12-01 08:18:49 -07:00
Ed Hartnett
8e47b9bbc2 merged ejh_more_warnings 2017-11-24 10:14:57 -07:00
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
7e662c6b87 fixed easy warnings 2017-11-20 05:55:04 -07:00
Ed Hartnett
3b82328902
Merge branch 'master' into ejh_more_warnings 2017-11-15 03:41:12 -07:00
Ed Hartnett
013151edc6 fixed leak relating to var->params 2017-11-14 09:15:13 -07:00
Ward Fisher
16d6f94f30 Merge branch 'master' into filters.dmh 2017-11-13 11:15:02 -07:00
Ed Hartnett
6d31b47543
Merge branch 'master' into ejh_more_warnings 2017-11-10 02:52:46 -07:00
Ward Fisher
a9dde277d7 Merge branch 'ejh_enum_mem_fix' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into more_ejh_pulls 2017-11-09 16:11:17 -07:00
Ed Hartnett
0e0482bc05 fixed warnings 2017-11-09 06:24:18 -07:00
Ed Hartnett
b9911d6e6f took out most uses of EXTRA_TESTS, returned it to disabled by default 2017-11-08 13:25:23 -07:00
Ed Hartnett
a72d5b4d16
Merge branch 'master' into ejh_enum_mem_fix 2017-11-07 18:34:55 -07:00
Ed Hartnett
ef05ba642f
Merge branch 'master' into ejh_remove_counts 2017-11-05 10:08:36 -07:00
Ed Hartnett
7872785cf0
Merge branch 'master' into ejh_enum_mem_fix 2017-11-03 19:44:40 -06:00
Ward Fisher
f98635be1b Merge remote-tracking branch 'origin/h5offset.dmh' into dmh_multi_merge 2017-11-03 12:40:52 -06:00
Ed Hartnett
0ac8ec40a1 removed archaic code to check memory use 2017-11-02 11:40:13 -06:00
Ed Hartnett
406e979fb4 fixed tst_enums memory issue 2017-11-01 04:31:12 -06:00
Ward Fisher
d7f0919c12
Merge branch 'master' into NC_MAX_VAR_DIMS 2017-10-31 14:06:41 -06:00
Dennis Heimbigner
2d77e6451b Master merge 2017-10-28 14:06:39 -06:00
Dennis Heimbigner
261ed4c99d Merge branch 'master' into h5offset.dmh 2017-10-27 12:33:17 -06:00
Ed Hartnett
c36554ffb8 fixed memory error in handling of (ignored) reference atts in HDF5 file 2017-10-27 06:08:22 -06:00
Ward Fisher
bacdef88fe Merge branch 'master' into NC_MAX_VAR_DIMS 2017-10-26 14:31:22 -06:00
Ward Fisher
b066a2ac76 Merge branch 'ejh_fix_nc4info_warnings' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into merge_small_pulls 2017-10-25 11:03:35 -06:00
Ed Hartnett
785e0c3a9a fixed warning in nc4var.c 2017-10-25 04:55:56 -06:00
Ed Hartnett
19e248c63e fixed compile warnings in nc4info.c 2017-10-25 04:48:03 -06:00
Ed Hartnett
26f443b7ac fixed warnings in libsrc4/nc4hdf.c 2017-10-25 04:28:24 -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
5ff3909704 Fix bug in nc4file.c where it improperly handled filters with more than 4 parameters. 2017-10-09 21:24:56 -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
Dennis Heimbigner
ed44fd7306 Add szip support via libaec 2017-08-27 13:35:20 -06: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
Ward Fisher
24ca95645c Applied fix for a stack buffer overflow into 4.5.0 release branch. 2017-08-08 13:18:53 -06:00
Ward Fisher
f6ac978f25 Merge branch 'master' into fix_nc4_check_name_buffer_overflow 2017-08-08 11:22:06 -06:00
Ward Fisher
05d3d7e9f5 Merge remote-tracking branch 'origin/d4tempfile.dmh' into v4.5.0-release-branch 2017-08-07 10:12:36 -06:00
Dennis Heimbigner
4d8fbbf501 If DAP (2 or 4) is enabled, but diskless is disabled, then the
dap code will create a real temporary file in which to store the
converted metadata for the DAP .dds or .dmr.

It was assumed that the nc_close code would reclaim the
temporary file. For DAP2, reclamation occurs in the ncio
code. For DAP4, it was assumed that the libsrc4 code would do
the reclamation, but for whatever reason, this is not happening.
Thus, in this situation, a temporary file is left in the file
system. Aside from being irritating to users, this screws up
'make distcheck'.

So the DAP4 code is fixed to ensure that the temporary file is
properly reclaimed independent of the libsrc4 code.
2017-08-05 22:41:31 -06:00
Even Rouault
1989ddc252 Fix stack buffer overflow in nc4_check_name()
nc4_check_name() checks that the provided string doesn't exceed NC_MAX_NAME,
but fails to do so after calling nc_utf8_normalize(). This extra check is
needed since a caller of nc4_check_name(), like NC4_def_dim, allocates
norm_name as char norm_name[NC_MAX_NAME + 1]

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2840
Credit to OSS-Fuzz
2017-08-02 21:57:36 +02: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
Ward Fisher
8a4f5aea95 Corrected a double-free reported by static analysis. 2017-06-15 12:09:54 -06:00
Even Rouault
d02e3c952b Fix memory leak in NC4_put_propattr()
Current code only frees char* text in error cases. It should
also free it in success case.

Otherwise Valgrind reports a leak:

==28536== 64 bytes in 1 blocks are definitely lost in loss record 4 of 13
==28536==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28536==    by 0xE673496: NC4_buildpropinfo (nc4info.c:239)
==28536==    by 0xE67313B: NC4_put_propattr (nc4info.c:162)
==28536==    by 0xE65BF35: nc4_create_file (nc4file.c:468)
==28536==    by 0xE65C0AC: NC4_create (nc4file.c:564)
==28536==    by 0xE608A08: NC_create (dfile.c:1773)
==28536==    by 0xE607E6A: nc__create (dfile.c:511)
==28536==    by 0xE607E23: nc_create (dfile.c:440)

Credit to OSS Fuzz
2017-06-07 10:48:38 +02:00
Dennis Heimbigner
c834d4af12 merge from master 2017-05-10 12:33:03 -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
Dennis Heimbigner
32fe709615 ckp 2017-04-14 11:05:30 -06:00
Ward Fisher
b5b99cbebb Merge branch 'master' into ghpull-375 2017-04-05 16:24:55 -06:00
Dennis Heimbigner
5f15c9e777 1) master merge 2)fix uname -o problem 2017-03-30 16:21:31 -06:00
Greg Sjaardema
97c27b1582 Merge branch 'master' into patch-1 2017-03-29 20:19:37 -06:00
Wei-keng Liao
1508bd5529 fix the previous commit that missed the case of re-open file 2017-03-29 12:16:25 -05:00
Dennis Heimbigner
80390b94e5 keep up-to-date with master 2017-03-27 12:16:24 -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
eeb673bf8c Merge branch 'master' into ghpull-375 2017-03-22 11:24:56 -06:00
Greg Sjaardema
26c393cd13 Merge branch 'master' into patch-1 2017-03-15 08:50:12 -06:00
Stephan Hoyer
4dd8e380c1 Switch NC_CHAR on netCDF4 to use ASCII
Fixes GH298
2017-03-13 20:12:08 -07:00
Ward Fisher
d4a4dfdd15 Resolved a conflict. 2017-03-13 14:23:57 -06:00
Ward Fisher
8e3790f7ce Merged master. 2017-03-09 12:53:28 -07:00
Dennis Heimbigner
3db4f013bf Primary change: add dap4 support
Specific changes:
1. Add dap4 code: libdap4 and dap4_test.
   Note that until the d4ts server problem is solved, dap4 is turned off.
2. Modify various files to support dap4 flags:
	configure.ac, Makefile.am, CMakeLists.txt, etc.
3. Add nc_test/test_common.sh. This centralizes
   the handling of the locations of various
   things in the build tree: e.g. where is
   ncgen.exe located. See nc_test/test_common.sh
   for details.
4. Modify .sh files to use test_common.sh
5. Obsolete separate oc2 by moving it to be part of
   netcdf-c. This means replacing code with netcdf-c
   equivalents.
5. Add --with-testserver to configure.ac to allow
   override of the servers to be used for --enable-dap-remote-tests.
6. There were multiple versions of nctypealignment code. Try to
   centralize in libdispatch/doffset.c and include/ncoffsets.h
7. Add a unit test for the ncuri code because of its complexity.
8. Move the findserver code out of libdispatch and into
   a separate, self contained program in ncdap_test and dap4_test.
9. Move the dispatch header files (nc{3,4}dispatch.h) to
   .../include because they are now shared by modules.
10. Revamp the handling of TOPSRCDIR and TOPBUILDDIR for shell scripts.
11. Make use of MREMAP if available
12. Misc. minor changes e.g.
	- #include <config.h> -> #include "config.h"
	- Add some no-install headers to /include
	- extern -> EXTERNL and vice versa as needed
	- misc header cleanup
	- clean up checking for misc. unix vs microsoft functions
13. Change copyright decls in some files to point to LICENSE file.
14. Add notes to RELEASENOTES.md
2017-03-08 17:01:10 -07:00
Ward Fisher
2558fd6f9f Merge branch 'att_callbk' of https://github.com/brtnfld/netcdf-c into gh276 2017-03-06 12:56:33 -07:00
Greg Sjaardema
cbb9448ab0 Remove unused fields from struct
The nvars, ndims, and natts fields on the NC_HDF5_FILE_INFO struct are
never set.  The nvars field is read, but since it is never written,
the value is always zero.
2017-03-06 11:14:00 -07:00
Greg Sjaardema
473529d199 Remove unused ndims from grp struct 2017-03-06 11:14:00 -07:00
Dennis Heimbigner
47daf33074 Resolves Github issue https://github.com/Unidata/netcdf-c/issues/349.
Update utf8proc.[ch] to use the version now
maintained by the Julia Language project
(https://github.com/JuliaLang/utf8proc/blob/master/LICENSE.md).
The license for the previous version was
unacceptable for the Debian and Ubuntu release
systems. The new version both updates the code
and addresses the license issue.

It turns out that the utf8proc software we are using
was turned over to the Julia Language developers
and the license terms changed to allow modification.
(https://github.com/JuliaLang/utf8proc/blob/master/LICENSE.md).

So the fix here is as follows:
1. Wrap the library with a fixed interface: libdispatch/dutf8.c
   and include/ncutf8.h.
2. Replace the existing utf8proc code with the new version
   from https://github.com/JuliaLang/utf8proc.
3. Add a couple more test cases: nc_test/tst_utf8_validate.c
   and nc_test_utf8_phrases.c.  If/when I can find a usable
   normalization test, I will incorporate that later.
2017-02-16 14:27:54 -07:00
Ward Fisher
7edb08977a Added platform checks for ARM. 2017-02-03 11:19:39 -07:00
Ward Fisher
3e5124996e Merged https://github.com/Unidata/netcdf-c/pull/319 to resolve some recently arisen conflicts, in preparation for larger merge. 2017-02-01 13:27:29 -07:00
Ward Fisher
0d2727d9da Merging pull request from gsjaardema, see https://github.com/Unidata/netcdf-c/pull/335 for more information. 2017-01-30 12:45:50 -07:00
Greg Sjaardema
b334171548 Merge branch 'master' into patch-1 2017-01-11 21:18:03 -07:00
Ward Fisher
34161aab69 Added fixes for Visual Studio 10 2017-01-10 13:54:09 -07:00
Greg Sjaardema
a2fdfa04ab Eliminate an MPI_Allreduce in many cases 2016-12-09 09:52:15 -07:00
Greg Sjaardema
f8e818385e Modify previous no_fill setting
HDF5 does not permit a variable to have no_fill == TRUE if the variable type is variable length.  This includes types NC_STRING and NC_VLEN.  

The test above also excludes user-defined types which I'm not sure is needed or not.
2016-12-05 11:08:26 -07:00
Greg Sjaardema
8401e2087e Set variable no_fill to match database default (nc4)
In nc4 mode, the variables were ignoring the default "database" fill/no_fill mode set via a call to nc_set_fill().  This sets the no_fill mode on the variable to match the default database setting at the time the variable is defined.
2016-12-02 08:17:47 -07:00
Greg Sjaardema
72c1948980 Move metadata ops calls 2016-12-01 13:35:16 -07:00
Greg Sjaardema
e0269d6cac Add hdf5 collective metadata api detection to cmake build 2016-12-01 13:35:10 -07:00
Greg Sjaardema
39c90e7b76 Enable collective metadata operations for hdf5-1.10; not protected yet 2016-12-01 13:34:58 -07:00
Wei-keng Liao
fe9685deb4 implement an error code precedence 2016-12-01 12:31:20 -06:00
Wei-keng Liao
4cdbf7dba5 Merge branch 'master' into issue258 2016-12-01 01:09:45 -06:00
Ward Fisher
767a5b372c Corrected an issue reported as part of the pull request at https://github.com/Unidata/netcdfic/pull/328 2016-11-28 13:31:43 -07:00
Ward Fisher
05ceb8d471 Merge branch 'nc4-var-array' of https://github.com/gsjaardema/netcdf-c into gh328 2016-11-28 13:10:07 -07:00
Wei-keng Liao
ab73a57fca Merge branch 'master' into issue258 2016-11-25 10:49:03 -06:00
Ward Fisher
24a4a230e6 Updated debugging script, fixed a problem in logging type size. 2016-11-16 12:18:20 -07:00
Greg Sjaardema
b9c50aec89 Create var correctly for hdf4 files 2016-11-16 10:37:37 -07:00
Greg Sjaardema
a55d96eba1 Clean-up build after changes -- remove unused variables 2016-11-16 08:45:28 -07:00
Greg Sjaardema
207a2ee4f9 Fix stdc violation 2016-11-16 08:45:23 -07:00
Greg Sjaardema
d16f5a8842 Whitespace cleanup 2016-11-16 08:45:19 -07:00
Greg Sjaardema
8698e57424 Compile with c89 -- eliminate init in for-loop 2016-11-16 08:45:15 -07:00
Greg Sjaardema
c84b475ccf Remove var linked list 2016-11-16 08:45:10 -07:00
Greg Sjaardema
dee1baca8e Store vars in array instead of linked list (linked list still active) 2016-11-16 08:45:06 -07:00
Wei-keng Liao
e8cfdbb25a Merge branch 'master' into issue258 2016-11-13 00:00:54 -06:00
Wei-keng Liao
2081ae7099 add configure option --enable-relax-coord-bound for issue #243 2016-11-12 23:58:09 -06:00
Ward Fisher
f4ac2f827d Merge branch 'patch-4' of https://github.com/gsjaardema/netcdf-c into gh290 2016-11-09 12:27:48 -07:00
Wei-keng Liao
4725c1484b move varid check right after ncid 2016-10-12 13:33:17 -05:00
Wei-keng Liao
dbb9be59d2 temporally disable __arm__ for testing 2016-10-09 22:21:32 -05:00
Ward Fisher
49fb3241c6 Corrected coverity issue 1372965. 2016-09-15 11:07:11 -06:00
Greg Sjaardema
dab30468f9 Merge branch 'master' into patch-4 2016-09-15 11:04:30 -06:00
Ward Fisher
a08be0a312 Corrected issue 1372910 in coverity. 2016-09-14 16:26:08 -06:00