Commit Graph

49 Commits

Author SHA1 Message Date
Wei-keng Liao
9b511b4e0f fix codes might break strict-aliasing rules 2017-11-16 00:01:01 -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
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
f4151c97f2 Reverted changes to X_get_size_t, in order to correct an issue 2017-05-31 09:40:59 -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
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
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
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
Wei-keng Liao
2081ae7099 add configure option --enable-relax-coord-bound for issue #243 2016-11-12 23:58:09 -06:00
Wei-keng Liao
06c1f744e8 silence gcc compile warnings when using -Wconversion 2016-10-30 00:44:28 -05:00
Wei-keng Liao
7572e1cbbf add sizeof checks for unsigned data types 2016-10-28 18:16:49 -05:00
Wei-keng Liao
309303e34e remove argument fillv for get APIs as we use default fill values for fillv 2016-10-28 10:34:51 -05:00
Wei-keng Liao
7fbde1b5bc add a new option ERANGE_FILL to use fill values when NC_ERANGE occurs; sync ncx.m4 with PnetCDF 2016-10-25 15:09:52 -05:00
Wei-keng Liao
0d24dccbd3 copy ncx.m4 from PnetCDF 2016-10-13 02:15:45 -05:00
Wei-keng Liao
f336af5474 now ncx.m4 is the same as PnetCDF's except PNETCDF is not defined 2016-10-09 21:58:43 -05:00
Wei-keng Liao
39b47f6d78 borrow ncx.m4 from PnetCDF 2016-10-06 00:36:54 -05:00
Ward Fisher
fb2ff0c24b Refactored old ENOERR code into NC_NOERR error code in libsrc. This is done in support of https://github.com/Unidata/netcdf-c/issues/213. 2016-03-07 10:58:02 -07:00
Ward Fisher
103863ca24 More architecture-specific fenceposting. 2015-12-24 16:42:54 +00:00
Ward Fisher
d71e9ed5f6 Fenceposting the bug fixes with __arm__ ifdefs. 2015-12-24 09:35:32 -07:00
Ward Fisher
925da14d2a Some additional errors reared up after fixing the main frustrating one. Working towards fixing them. 2015-12-24 01:37:42 +00:00
Ward Fisher
6eec405e13 Added explit cast from signed in ncx.m4 to address https://github.com/Unidata/netcdf-c/issues/159. It is likely overly broad; I will refine it once I've had a chance to read up on m4. 2015-12-23 22:16:49 +00:00
Ward Fisher
612b35a84c Merge branch 'master' into cdf-5, in preparation for merging the CDF-5 functionality into the master branch. This will be the key new feature for netcdf 4.4.0. 2015-11-05 13:40:35 -07:00
Ward Fisher
5e9fe31ae7 Updating .m4 file. 2015-10-21 15:04:59 -06:00
Ward Fisher
225050c4b7 Tweaked .m4 file for a specific case. 2015-10-21 19:11:22 +00:00
Dennis Heimbigner
cd7a06b193 pull request 2015-10-12 17:09:37 -06:00
dmh
9f65c3b808 cleanup and squash changes vav master 2015-10-09 10:26:49 -06:00
dmh
8fc86035b2 merge-squash 2015-10-09 10:22:00 -06:00
dmh
087ae58ffd cleanup and squash changes vav master 2015-10-09 10:12:11 -06:00
dmh
49597a64af merge-squash 2015-10-09 10:12:11 -06:00
tbeu
e2820e4d8a Fix common typos
Detected by https://github.com/vlajos/misspell_fixer
2015-08-20 11:42:05 +02:00
dmh
2bfe9bba32 cleanup and squash changes vav master 2015-08-16 21:44:18 -06:00
dmh
859f105005 merge-squash 2015-08-15 16:26:35 -06:00
dmh
fab66699d1 Moved libsrc5 to libsrcp
because pnetcdf is used for
more than CDF-5 files.
2015-08-14 20:39:56 -06:00
Ward Fisher
95cbe52b37 Additional changes to hopefully get autotools and tst_swap4b working together in service of addressing [NCF-338] 2015-07-28 13:43:15 -06:00
Ward Fisher
8f2bf0089e Some tweaks, trying to debug autotools-based build. 2015-07-28 12:38:52 -06:00
Ward Fisher
ac18154e98 Added test for function swap4b. 2015-07-27 15:31:23 -06:00
Ward Fisher
1ea348ce3d Applied patch suggested for in-place big-little-endian conversion. [NCF-338] 2015-07-27 11:09:01 -06:00
Rob Latham
3b61804ff7 fix m4 dealing with split lines
Wei-keng Liao fixed this for pnetcdf. See pnetcdf revision 1904.
2014-12-05 12:55:38 -06:00
Quincey Koziol
cd71eb525c Corrected "BAIL" macros to avoid infinite loop when logging is disabled and an
error occurs after an "exit:" label.

Corrected a dozen Coverity errors (mainly allocation issues, along with a few
    other things):
        711711, 711802, 711803, 711905, 970825, 996123, 996124, 1025787,
        1047274, 1130013, 1130014, 1139538

Refactored internal fill-value code to correctly handle string types, and
    especially to allow NULL pointers and null strings (ie. "") to be
    distinguished.  The code now avoids partially aliasing the two together
    (which only happened on the 'write' side of things and wasn't reflected on
    the 'read' side, adding to the previous confusion).

    Probably still weak on handling fill-values of variable-length and compound
    datatypes.

Refactored the recursive metadata reads a bit more, to process HDF5 named
    datatypes and datasets immediately, avoiding chewing up memory for those
    types of objects, etc.

Finished uncommenting and updating the nc_test4/tst_fills2.c code (as I'm
    proceeding alphabetically through the nc_test4 code files).
2013-12-29 01:12:43 -06:00
Ward Fisher
2dc39563cc Changes in suport of CMake 2012-07-16 22:31:35 +00:00
Russ Rew
74f8a38e2a Test for macro definitions of LLONG_MAX, LLONG_MIN, ULONG_MAX in <limits.h> to fix portability problem. 2012-06-05 17:02:43 +00:00
Russ Rew
d6d38094c2 Cleaned up tst_atts3.c test program. Fixed several bugs in detection
of NC_ERANGE errors, especially with unsigned types, resolving most
NCF-172 issues and confusion between long and long long types in
llibsrc/ncx.m4.  Eliminated some unnecessary tests, e.g. tests
for negative values for unsigned types.
2012-05-31 01:28:42 +00:00
Russ Rew
1f4eeafcb9 Fixed doxygen installation guide source file to preserve line breaks
in code and scripts.

Fixed bug NCF-171: error reading external int into longlong or writing
from longlong array to external int on 32-bit platforms and classic
format files.

Promoted test demonstrating NCF-171 bug from longlong array from
"extra test" to "test".
2012-05-29 15:50:15 +00:00
Ed Hartnett
18f4bca367 moving to trunk subdir 2010-06-03 13:24:43 +00:00