summaryrefslogtreecommitdiffstats
path: root/src/H5Tconv.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2011-11-15 22:45:06 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2011-11-15 22:45:06 (GMT)
commitdb7410f838e6319dc87413e27f18b0b8ac050314 (patch)
tree5bec749becb120ca24fae2390a1712405331fb08 /src/H5Tconv.c
parentec688f92b94b9b6bdcfdc63058aef41fc5d97c0c (diff)
downloadhdf5-db7410f838e6319dc87413e27f18b0b8ac050314.zip
hdf5-db7410f838e6319dc87413e27f18b0b8ac050314.tar.gz
hdf5-db7410f838e6319dc87413e27f18b0b8ac050314.tar.bz2
[svn-r21765] Issue 7618 - the library had seg fault when it tried to shrink the size of compound data type through H5Tset_size immediately after the type was created. I fixed it in this commit. I'm bringing the fix from the trunk. The only files being change are test/dtypes.c, src/H5T.c, src/H5Tconv.c, and release_docs/RELEASE.txt. All others are property changes.
Tested on jam, koala, and linew.
Diffstat (limited to 'src/H5Tconv.c')
-rw-r--r--src/H5Tconv.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 0de54c9..3209d3e 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -2913,6 +2913,9 @@ done:
* old data. At this moment, it only frees the first level of
* VL datatype. It doesn't handle nested VL datatypes.
*
+ * Raymond Lu, 8 November 2011
+ * I put a condition check to prevent the conversion of VL strings
+ * between ASCII and UTF8.
*-------------------------------------------------------------------------
*/
herr_t
@@ -2963,6 +2966,11 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_VLEN datatype")
if(H5T_VLEN != dst->shared->type)
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_VLEN datatype")
+ if(H5T_VLEN_STRING == src->shared->u.vlen.type && H5T_VLEN_STRING == dst->shared->u.vlen.type) {
+ if((H5T_CSET_ASCII == src->shared->u.vlen.cset && H5T_CSET_UTF8 == dst->shared->u.vlen.cset)
+ || (H5T_CSET_ASCII == dst->shared->u.vlen.cset && H5T_CSET_UTF8 == src->shared->u.vlen.cset))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "The library doesn't convert between strings of ASCII and UTF")
+ }
/* Variable-length types don't need a background buffer */
cdata->need_bkg = H5T_BKG_NO;
@@ -4360,6 +4368,10 @@ done:
* then convert one value at each memory location advancing
* BUF_STRIDE bytes each time; otherwise assume both source and
* destination values are packed.
+ *
+ * Raymond Lu, 8 November 2011
+ * I put a condition check to prevent the conversion of strings
+ * between ASCII and UTF8.
*-------------------------------------------------------------------------
*/
herr_t
@@ -4391,6 +4403,9 @@ H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad source character set")
if(H5T_CSET_ASCII != dst->shared->u.atomic.u.s.cset && H5T_CSET_UTF8 != dst->shared->u.atomic.u.s.cset)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad destination character set")
+ if((H5T_CSET_ASCII == src->shared->u.atomic.u.s.cset && H5T_CSET_UTF8 == dst->shared->u.atomic.u.s.cset)
+ || (H5T_CSET_ASCII == dst->shared->u.atomic.u.s.cset && H5T_CSET_UTF8 == src->shared->u.atomic.u.s.cset))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "The library doesn't convert between strings of ASCII and UTF")
if(src->shared->u.atomic.u.s.pad < 0 || src->shared->u.atomic.u.s.pad >= H5T_NPAD ||
dst->shared->u.atomic.u.s.pad < 0 || dst->shared->u.atomic.u.s.pad >= H5T_NPAD)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad character padding")