Commit Graph

346 Commits

Author SHA1 Message Date
Wei-keng Liao
680a6edd29 reset to original ncp->begin_var, instead of 0 2017-09-08 02:18:00 -05:00
Wei-keng Liao
52bfe51188 fix error code returned from nc_close while a failed nc__enddef occurs 2017-09-07 20:23:17 -05: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
Lars Pastewka
bd33076424 Fixed computation of recsize for NC_64BIT_DATA files. 2017-08-09 21:47:08 +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
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
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
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
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
Wei-keng Liao
7aa8fc36c7 include config.h the way suggested by autoconf 2017-03-11 13:03:17 -06:00
Wei-keng Liao
af258dcec9 update for arm to use char as much as possible, instead of signed char 2017-03-10 12:00:59 -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
ec526880dd Merge branch 'master' into NC_USHORT_rec_align 2017-03-02 15:22:36 -07:00
Ward Fisher
1a8e7891f0 Merge branch 'master' into master 2017-03-02 13:34:51 -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
a257db6670 Merge branch 'ghpull-319' into ghpull-319-arm 2017-02-14 10:51:53 -07:00
Ward Fisher
eec0a81437 Merge branch 'issue258' of https://github.com/wkliao/netcdf-c into ghpull-319 2017-02-14 10:51:21 -07:00
Wei-keng Liao
fc40f92fca bug fix: values stored in NC_attr.xvalue are in external representation, may need byte-swap when retrieved to a memory buffer (internal representation) 2017-02-10 17:46:26 -06:00
Ward Fisher
20721cc46b Additional work in trying to diagnose failures in nc_test. 2017-02-07 15:16:32 -07:00
Ward Fisher
e100aaf6b0 We cannot assume char is signed or unsigned. 2017-02-07 14:20:59 -07:00
Ward Fisher
6689d7a63f Adjusted behavior when casting from a signed char pointer to an unsigned type. 2017-02-03 12:21:54 -07:00
Ward Fisher
fe17747261 Corrected missing endif stanza. 2017-02-03 11:29:59 -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
Romero B. de S. Malaquias
dfda46a3a0 Merge branch 'master' into master 2017-01-11 09:29:40 -03:00
Romero B. de S. Malaquias
452f6e2361 Avoiding conditional directives that break statements 2017-01-10 16:46:17 -03:00
Ward Fisher
a099c974dc Deleted extraneous header file, removed extraneous . 2017-01-09 13:26:23 -07:00
Ward Fisher
5502767d98 Added code to accomodate Visual Studio 2012 in support of https://github.com/Unidata/netcdf-c/issues/304 2017-01-09 13:02:08 -07:00
Ward Fisher
029cbd7aeb Another tweak for a rushed fix. 2017-01-09 12:01:17 -07:00
Ward Fisher
7d75fd3731 Updated code, location of variable declarations in support of https://github.com/Unidata/netcdf-c/issues/304 2017-01-09 11:37:35 -07:00
Ward Fisher
2f3b894bec Reverted to different code in support of https://github.com/Unidata/netcdf-c/issues/344 2017-01-04 15:40:19 -07:00
Ward Fisher
59618c481b Removed stray comment. 2017-01-03 13:57:30 -07:00
Ward Fisher
c13c917835 Addressing an issue in https://github.com/Unidata/netcdf-c/issues/344 not sure if this is a fix, but why were the casts to float being used? 2017-01-03 12:21:54 -07:00
Ward Fisher
ad58e5232a Small tweak to cmakelists.txt 2017-01-03 12:10:05 -07:00
Wei-keng Liao
fe9685deb4 implement an error code precedence 2016-12-01 12:31:20 -06:00
Wei-keng Liao
340f0d2a91 Classic Format Specification says: Header padding uses null (\x00) bytes 2016-11-28 11:54:16 -06:00