Skip to content

Commit 7e41e0e

Browse files
committed
fix a segfault in the two-phase I/O algorithm for fileviews of 0 byte size.
1 parent 02311cd commit 7e41e0e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ompi/mca/fcoll/two_phase/fcoll_two_phase_file_write_all.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,14 @@ mca_fcoll_two_phase_file_write_all (mca_io_ompio_file_t *fh,
314314
flat_buf->count = local_size;
315315
i=0;j=0;
316316
while(j < local_size){
317-
flat_buf->indices[j] = (OMPI_MPI_OFFSET_TYPE)(intptr_t)decoded_iov[i].iov_base;
318-
flat_buf->blocklens[j] = decoded_iov[i].iov_len;
317+
if ( 0 < max_data ) {
318+
flat_buf->indices[j] = (OMPI_MPI_OFFSET_TYPE)(intptr_t)decoded_iov[i].iov_base;
319+
flat_buf->blocklens[j] = decoded_iov[i].iov_len;
320+
}
321+
else {
322+
flat_buf->indices[j] = 0;
323+
flat_buf->blocklens[j] = 0;
324+
}
319325
if(i < (int)iov_count)
320326
i+=1;
321327
j+=1;

0 commit comments

Comments
 (0)