Commit Graph

4079 Commits

Author SHA1 Message Date
Ward Fisher
8ee484b039 Merge branch 'fix_undefined_left_shift_in_ncx_get_size_t' of https://github.com/rouault/netcdf-c into v3.5.0-release-branch 2017-06-26 11:03:02 -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
Ward Fisher
3cded7eb08 Merge pull request #430 from Unidata/ncgenutf8.dmh
Remove more old utf8 code
2017-06-20 10:46:27 -06:00
Dennis Heimbigner
9cde91687a re: pull request https://github.com/Unidata/netcdf-c/pull/364
This is a follow-on in that the old utf8 code was still being
used in ncgen to convert utf8->utf16 when converting cdl to Java
(see genj.c).

The new code apparently has no utf16 support, but it does have
utf32 support. Converting utf32 -> utf16 can be approximated by
truncating the 32bits to 16 bits, unless the top 16 bits are
not zero. This latter condition is unlikely to be common because
it implies use of some rather obscure characters.

So solution is to convert to utf32 and truncate to 16 bits to
get utf16. An error is reported if the high-order truncated 16
bits are not zero. If we get complaints, then I will figure out
how to convert full utf32 to a utf16 pair.

Other changes:
1. removed the old code from ncgen.
2. changed UTF8PROC_DLLEXPORT (in utf8proc) to EXTERNL
   and added appropriate includes. This should fix
   issue https://github.com/Unidata/netcdf-c/issues/404,
   but since we cannot duplicate the failure, I am not quite
   sure.
2017-06-18 21:06:19 -06:00
Dennis Heimbigner
e2e7c20444 Merge branch 'v4.5.0-release-branch' into ncgenutf8.dmh 2017-06-18 16:38:13 -06:00
Ward Fisher
8a4f5aea95 Corrected a double-free reported by static analysis. 2017-06-15 12:09:54 -06: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
08c51e6064 Corrected a couple issues uncovered when revisiting https://github.com/Unidata/netcdf-c/issues/244 2017-06-14 14:01:09 -06: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
Ward Fisher
12d224eeef Corrected an issue in support of https://github.com/Unidata/netcdf-c/issues/420 2017-06-09 12:46:37 -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
Ward Fisher
4097dd9826 Change to address issue reported in https://github.com/Unidata/netcdf-c/issues/413 2017-06-08 11:55:00 -06:00
Ward Fisher
af91d03bac Merge branch 'fix-find-ncxx-configs' of https://github.com/ZedThree/netcdf-c into v4.5.0-release-branch 2017-06-07 17:20:16 -06:00
Ward Fisher
40f616488c Corrected release notes again. 2017-06-07 17:14:04 -06:00
Ward Fisher
4d941f5f02 Corrected release notes. 2017-06-07 15:27:11 -06:00
Ward Fisher
e0a1b9aafe Merge branch 'master' into fieldmap.dmh 2017-06-07 14:14:33 -06:00
Ward Fisher
3a0b0d5339 Replaced sed with configure_ac_files, since sed may not be available. 2017-06-07 13:21:07 -06:00
Ward Fisher
6da1539ff9 Removed software.md from dist file. 2017-06-07 12:58:23 -06:00
Ward Fisher
1d9bd601bd Merge branch 'remove_x_int64' of https://github.com/wkliao/netcdf-c into v4.5.0-release-branch 2017-06-07 12:20:29 -06:00
Ward Fisher
d7559717a6 Merge branch 'fix_leak_in_NC4_put_propattr' of https://github.com/rouault/netcdf-c into v4.5.0-release-branch 2017-06-07 12:04:31 -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
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
Dennis Heimbigner
30846cfff1 Cmake 2017-06-06 16:21:04 -06:00
Dennis Heimbigner
8f2f9b74e3 re: pull request https://github.com/Unidata/netcdf-c/pull/364
This is a follow-on in that the old utf8 code was still being
used in ncgen to convert utf8->utf16 when converting cdl to Java
(see genj.c).

The new code apparently has no utf16 support, but it does have
utf32 support. Converting utf32 -> utf16 can be approximated by
truncating the 32bits to 16 bits, unless the top 16 bits are
not zero. This latter condition is unlikely to be common because
it implies use of some rather obscure characters.

So solution is to convert to utf32 and truncate to 16 bits to
get utf16. An error is reported if the high-order truncated 16
bits are not zero. If we get complaints, then I will figure out
how to convert full utf32 to a utf16 pair.

Also removed the old code from ncgen.
2017-06-06 15:23:59 -06:00
Ward Fisher
b039216c42 Made memory free method conditional, based on if H5free_memory is available in libhdf5 or not. In support of code contributed by Greg Sjaardema . See https://github.com/Unidata/netcdf-c/pull/411 for more information. 2017-06-06 11:33:05 -06:00
Greg Sjaardema
ebed788181 Use H5free_memory instead of free
The documentation for `H5Tget_member_name` states that the memory returned should be freed by `H5free_memory` instead of `free`.  I was getting test failure until I changed this to call H5free_memory on a Mac OS Sierra system with hdf5-1.9.236
2017-06-06 13:22:02 -04:00
Ward Fisher
ecd40e688b Removed old unused file, static html version was moved into static/ subdirectory 2017-06-06 10:48:15 -06:00
Ward Fisher
ff8b93a1d6 Bumped release date. 2017-06-05 10:32:06 -06:00
Ward Fisher
c0d9c7c306 Merge branch 'master' into fix-find-ncxx-configs 2017-06-02 10:52:45 -06:00
Ward Fisher
89ebc2b778 Fixed an issue on visual studio which can result in a race state (more or less) when dap4 AND hdf4 support is enabled. 2017-06-01 14:48:23 -06:00
Ward Fisher
cc08dfd03e Removed an unnecessary template file. 2017-06-01 14:14:09 -06:00
Ward Fisher
81b0ab959a Fixed a missing file. 2017-06-01 14:13:54 -06:00
Ward Fisher
bad0058410 Corrected a missed string. 2017-06-01 13:40:04 -06:00
Ward Fisher
ec33411c6c Bumped revision information to next version. 2017-06-01 13:35:39 -06:00
Ward Fisher
cebc9301ec Merge branch 'gh410' 2017-06-01 11:16:11 -06:00
Ward Fisher
f1f7224f93 Corrected a false positive. 2017-06-01 09:36:54 -06:00
Ward Fisher
1f96a66414 hdf4 chunking file rename 2017-06-01 09:15:41 -06:00
Ward Fisher
a077289464 Refactored hdf4 chunking test a little bit. 2017-06-01 09:11:52 -06:00
Ward Fisher
08f7d06eb6 Refactoring hdf4 chunking test in similar fashion to hdf5 compatibility test. Files are linked via AC_CONFIG_LINKS instead of shuffling things around in a shell script. 2017-06-01 09:02:31 -06:00
Ward Fisher
128fb5611a Trying distcleanfiles experiment. 2017-06-01 08:53:31 -06:00
Ward Fisher
df872ac1bc Continued refactoring. 2017-05-31 16:34:46 -06:00
Ward Fisher
ef450c40a0 Refactoring test_common.sh template. 2017-05-31 16:16:41 -06:00
Ward Fisher
ebd1fca32a Working on reformulating test_common.sh 2017-05-31 15:42:59 -06:00
Ward Fisher
05e2ff3881 Sorting out hdf4 chunk tests. 2017-05-31 15:09:26 -06:00
Ward Fisher
5699a32376 Updated cleanfiles list on Makefile.am 2017-05-31 15:01:02 -06:00
Ward Fisher
9823d73c44 Corrected a logic error. 2017-05-31 14:04:53 -06:00
Ward Fisher
03c67cb4ff Updated src path in hdf4 chunk test. 2017-05-31 13:38:22 -06:00
Ward Fisher
9a8af9184a Copying files as needed for hdf4 tests. 2017-05-31 11:25:35 -06:00
Ward Fisher
1a2716b230 Changed the shell for a test to bash to catch a missing utility in some environments. 2017-05-31 11:00:04 -06:00