]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Protection against write on deallocated underground array of fields.
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 13 May 2016 06:41:14 +0000 (08:41 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 13 May 2016 06:41:14 +0000 (08:41 +0200)
src/MEDLoader/MEDFileField.cxx

index 698e6ecd77494c4a0ac1241de6f6267ad6c09078..85ffea449044e94ac5fbd93c1222b28210314f7c 100644 (file)
@@ -778,6 +778,8 @@ void MEDFileFieldPerMeshPerTypePerDisc::writeLL(med_idt fid, const MEDFileFieldN
   const DataArray *arr=getOrCreateAndGetArray();
   if(!arr)
     throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : no array set !");
+  if(!arr->isAllocated())
+    throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : the array to be written is not allocated !");
   const DataArrayDouble *arrD=dynamic_cast<const DataArrayDouble *>(arr);
   const DataArrayInt *arrI=dynamic_cast<const DataArrayInt *>(arr);
   const unsigned char *locToWrite=0;