From 4eed634bcf57fc1253f77bea2256d407db098d51 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Mon, 26 Mar 2007 13:55:36 -0500 Subject: [svn-r13542] Added a detection for zero-length VL data in H5T_conv_vlen to handle the case properly. This fix was discovered by the user while Bug #717 was being fixed. Modefied the test, too. --- src/H5Tconv.c | 8 ++++++- test/tvlstr.c | 6 ++++- test/tvltypes.c | 70 +++++++++++++++++++++++++++++++++++---------------------- 3 files changed, 55 insertions(+), 29 deletions(-) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index f151a1a..534820b 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -2837,7 +2837,13 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, dst_size=seq_len*dst_base_size; /* Check if conversion buffer is large enough, resize if - * necessary */ + * necessary. If the SEQ_LEN is 0, allocate a minimal size buffer. */ + if(src_size==0 && dst_size==0) { + conv_buf_size=((1/H5T_VLEN_MIN_CONF_BUF_SIZE)+1)*H5T_VLEN_MIN_CONF_BUF_SIZE; + if((conv_buf=H5FL_BLK_REALLOC(vlen_seq,conv_buf, conv_buf_size))==NULL) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion"); + } + if(conv_buf_size