If you are running on OS X 10.6 where is conf[j] created/initialized? maybe the 
compiler is getting more picky in OS X 10.7?
___________________________________________________________
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       [email protected] 
BlueQuartz Software               Dayton, Ohio

On Sep 28, 2011, at 1:28 PM, Amos Anderson wrote:

> Hi Bojan --
> 
> The crash is not happening in DataSet::p_read_fixed_len. I tried a
> bunch of things with Binh-Minh Ribler, but we were unable to resolve
> it, but here's a summary. The crash is in DataSet::p_read_variable_len
> on the line with:
> 
> strg = strg_C;
> 
> The error is a double free on strg:
> 
> Python(10981) malloc: *** error for object 0x104010820: pointer being
> freed was not allocated
> *** set a breakpoint in malloc_error_break to debug
> [amosa:10981] *** Process received signal ***
> [amosa:10981] Signal: Abort trap: 6 (6)
> [amosa:10981] Signal code:  (0)
> [amosa:10981] [ 0] 2   libsystem_c.dylib
> 0x00007fff8ce3bcfa _sigtramp + 26
> [amosa:10981] [ 1] 3   libhdf5.7.dylib
> 0x00000001042ec3f1 H5S_select_hyperslab + 1393
> [amosa:10981] [ 2] 4   libsystem_c.dylib
> 0x00007fff8ce3984c free + 389
> [amosa:10981] [ 3] 5   libstdc++.6.dylib
> 0x00007fff8c8f3702 _ZNSs4_Rep10_M_disposeERKSaIcE + 60
> [amosa:10981] [ 4] 6   libstdc++.6.dylib
> 0x00007fff8c8f4aab _ZNSs9_M_mutateEmmm + 281
> [amosa:10981] [ 5] 7   libstdc++.6.dylib
> 0x00007fff8c8f4b2d _ZNSs15_M_replace_safeEmmPKcm + 37
> [amosa:10981] [ 6] 8   libhdf5_cpp.7.dylib
> 0x000000010414af90 _ZNK2H57DataSet19p_read_variable_lenEiiiiRSs + 1316
> [amosa:10981] [ 7] 9   libhdf5_cpp.7.dylib
> 0x000000010414d5ea
> _ZNK2H57DataSet4readERSsRKNS_8DataTypeERKNS_9DataSpaceES7_RKNS_19DSetMemXferPropListE
> + 1286
> 
> 
> The problem does not occur in a standalone unit test I made (and there
> is no problem on linux or osx 10.6). This implies the problem could be
> somewhere else in the rest of my code, but unfortunately valgrind
> doesn't work on osx 10.7 yet (and no problems have been detected on
> other machines). However, I can make the problem go away if I
> initialize the std::string in my code before calling DataSet::read:
> 
>   H5::StrType st(H5::PredType::C_S1, H5T_VARIABLE);
>   H5::DataSet dataset;
>      Vector_string conf(dims[0]);
> #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1070
>         conf[j] = "hack to avoid crash";
> #endif
>         dataset.read(conf[j],st,mem_space,file_space);
> 
> 
> Doing a google search on the error message itself along with a few
> keywords revealed this:
> http://stackoverflow.com/questions/1962685/xcode-stl-c-debug-compile-error
> and other similar posts, problems which I am able to replicate, and
> sets a precedent for the problem being with the compiler itself. OSX
> 10.7 in general has seemed somewhat buggy too...
> 
> 
> Amos.
> 
> 
> 
> On Wed, Sep 28, 2011 at 3:48 AM, Bojan Nikolic <[email protected]> wrote:
>> 
>> I haven't had the time to test this hypothesis but looking at the HDF5
>> C++ wrapping code it looks like it may not be terminating the string
>> before converting to C++ std::string if the H5Dread doesn't do that by
>> itself for some reason. Maybe worth trying this patch?
>> 
>> 
>> *** hdf5-1.8.7/c++/src/H5DataSet-fix.cpp        2011-09-28 
>> 11:44:09.000000000 +0100
>> --- hdf5-1.8.7/c++/src/H5DataSet.cpp            2011-04-20 
>> 22:23:08.000000000 +0100
>> ***************
>> *** 721,729 ****
>>            throw DataSetIException("DataSet::read", "H5Dread failed for 
>> fixed length string");
>>        }
>> 
>> -         // Terminate the string
>> -         strg_C[attr_size]=0;
>> -
>>        // Get string from the C char* and release resource allocated locally
>>        strg = strg_C;
>>        delete []strg_C;
>> --- 721,726 ----
>> 
>> 
>> --
>> Bojan Nikolic          ||          http://www.bnikolic.co.uk
>> 
>> 
>> _______________________________________________
>> Hdf-forum is for HDF software users discussion.
>> [email protected]
>> http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
>> 
> 
> 
> 
> -- 
> ~<>~<>~<>~<>~<>~<>~<>~<>~
> Amos G. Anderson
> +1-626-399-8958 (cell)
> 
> _______________________________________________
> Hdf-forum is for HDF software users discussion.
> [email protected]
> http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org


_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to