Comments (6)
The issue isn't in getDim()
, insofar as it goes. It is properly bound checked, and NULL
is returned when appropriate. Investigating to see where the 'pointer being freed' is coming from, if it's the test case from which the fragment was provided, or if it's internal to netcdf-cxx4.
from netcdf-cxx4.
I'm pretty sure that the pointer having trouble being freed is from the
fragment, not internal to netcdf-cxx4. But... when I removed the
out-of-bounds call to getDim(), my problems ended.
Might the problem have to do with the subsequent NcDim constructor in:
netCDF::NcDim dim(ncvar.getDim(k));
What happens if NcDim::NcDim() is passed a null return from NcVar::getDim()?
On Tue, Jan 19, 2016 at 4:56 PM, Ward Fisher [email protected]
wrote:
The issue isn't in getDim(), insofar as it goes. It is properly bound
checked, and NULL is returned when appropriate. Investigating to see
where the 'pointer being freed' is coming from, if it's the test case from
which the fragment was provided, or if it's internal to netcdf-cxx4.—
Reply to this email directly or view it on GitHub
https://github.com/Unidata/netcdf-cxx4/issues/26#issuecomment-173000736.
from netcdf-cxx4.
I'm working on a test now to validate this, but from my read of the code, dim
would also be NULL
. This is in line with the C
library, I believe, which would be passed a destination pointer. In a similar test, the C function would return a non-fatal error code and the destination pointer would be NULL
.
The documentation for getDim()
, which I need to make more prominent (along with the other C++ interface documentation), says:
Gets the named NcDim object.
Parameters
name Name of dimension.
location Enumeration type controlling the groups to search.Returns
An NcDim object. If there are multiple objects indentied with the same name, the object closest to the current group is returned. If no valid object is found , a null node is returned.
from netcdf-cxx4.
I'd be happy to do some more tests on my end before you spend more time on
this. For example... I could do the out-of-bounds in situ in my example,
and see if the returned dimension has dim.isNull().
On Tue, Jan 19, 2016 at 6:04 PM, Ward Fisher [email protected]
wrote:
I'm working on a test now to validate this, but from my read of the code,
dim would also be NULL. This is in line with the C library, I believe,
which would be passed a destination pointer. In a similar test, the C
function would return a non-fatal error code and the destination pointer
would be NULL.The documentation for getDim(), which I need to make more prominent
(along with the other C++ interface documentation), says:Gets the named NcDim object.
Parameters
name Name of dimension.
location Enumeration type controlling the groups to search.Returns
An NcDim object. If there are multiple objects indentied with the same
name, the object closest to the current group is returned. If no valid
object is found , a null node is returned.—
Reply to this email directly or view it on GitHub
https://github.com/Unidata/netcdf-cxx4/issues/26#issuecomment-173016751.
from netcdf-cxx4.
That would be very helpful; if dim.isNull() is not true, that would definitely indicate an error.
from netcdf-cxx4.
On Windows, NcGroup::getDims (and thus getDim) fails if the file does not have any dims at all.
It is the ncCheck call at line 908 in NcGroup.cpp that fails because it refers to &dimids[0] when dimids is empty.
In Visual Studio 2013, debug mode, I don't catch any exception.
Edit: This refers to the latest official release from 2011, netcdf-cxx4-4.2.
from netcdf-cxx4.
Related Issues (20)
- Plain delete used on pointer allocated with new[] HOT 1
- Issue building with clang on macOS 11.3 HOT 3
- MacOS 11.3 Macports can't build netcdf-cxx @4.2 possibly due to VERSION
- Errors building 4.3.1 tag on macOS with Clang 12.0.5
- libnetcdf_c++4 vs. libnetcdf-cxx4 HOT 1
- Get attributes in the original order
- compile failure ncVar.cpp:630:11 error: 'nc_def_var_filter' was not declared in this scope (on static build) HOT 1
- header file is right? HOT 2
- Erroneous condition always evaluating true HOT 2
- Minimum required C++ standard?
- How to load data into a std::vector HOT 4
- 2 * field not copied in copy constructor ? HOT 1
- Does netcdf-cxx4 support parallel IO?
- netCDF::exceptions::NcHdfErr after calling getVar too often HOT 1
- CMake uninstall target conflicts with other previously registered uninstall targets
- Inconsistent constructor signatures
- HDF 1.14 + netcdf-c 4.9 Support? HOT 3
- Cmake modernization
- Testing: cxx4_test_filter (10/18) - Failed HOT 2
- [feature-request] `netcdfcpp_meta.h` file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from netcdf-cxx4.