This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hello, I've opened an issue on GitHub for this problem which you can view here: * https://github.com/Unidata/netcdf-cxx4/issues/26 Thanks for the bug report; I will get this fix in for the upcoming release! -Ward > I believe that NcVar::getDim() is not bounds checking its input parameter. > See below. > > Thanks, > -- Elizabeth > > I'm causing malloc() problems with the following code: > > for (int k=0; k<RANK; ++k) { > printf(" DD3.1 %ld %d\n", ncvar.getDimCount(), k); > ... > netCDF::NcDim dim(ncvar.getDim(k)); > > } > > This creates the output: > > DD3.1 2 0 > DD3.2 > DD3.3 > DD3.4 > DD3.1 2 1 > DD3.2 > DD3.3 > DD3.4 > DD3.1 2 2 > > > test_grid(86063,0x7fff729ac310) malloc: *** error for object > 0x7fd38053bdf8: pointer being freed was not allocated > > *** set a breakpoint in malloc_error_break to debug > > Ticket Details =================== Ticket ID: OBE-822161 Department: Support netCDF Priority: Normal Status: Closed