Skip to content

Commit 253d8fb

Browse files
committed
libdispatch: fix segfault (write to RO variable)
1 parent 0fc2c81 commit 253d8fb

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

libdispatch/ddispatch.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ See LICENSE.txt for license information.
3838

3939
/* Define vectors of zeros and ones for use with various nc_get_varX functions */
4040
/* Note, this form of initialization fails under Cygwin */
41-
size_t NC_coord_zero[NC_MAX_VAR_DIMS] = {0};
42-
size_t NC_coord_one[NC_MAX_VAR_DIMS] = {1};
43-
ptrdiff_t NC_stride_one[NC_MAX_VAR_DIMS] = {1};
41+
const size_t NC_coord_zero[NC_MAX_VAR_DIMS] = {0};
42+
const size_t NC_coord_one[NC_MAX_VAR_DIMS] = {1};
43+
const ptrdiff_t NC_stride_one[NC_MAX_VAR_DIMS] = {1};
4444

4545
/*
4646
static nc_type longtype = (sizeof(long) == sizeof(int)?NC_INT:NC_INT64);
@@ -55,12 +55,6 @@ NCDISPATCH_initialize(void)
5555
int i;
5656
NCglobalstate* globalstate = NULL;
5757

58-
for(i=0;i<NC_MAX_VAR_DIMS;i++) {
59-
NC_coord_zero[i] = 0;
60-
NC_coord_one[i] = 1;
61-
NC_stride_one[i] = 1;
62-
}
63-
6458
globalstate = NC_getglobalstate(); /* will allocate and clear */
6559

6660
/* Capture temp dir*/

0 commit comments

Comments
 (0)