Git Product home page Git Product logo

Comments (6)

WardF avatar WardF commented on July 20, 2024

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.

citibeth avatar citibeth commented on July 20, 2024

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.

WardF avatar WardF commented on July 20, 2024

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.

citibeth avatar citibeth commented on July 20, 2024

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.

WardF avatar WardF commented on July 20, 2024

That would be very helpful; if dim.isNull() is not true, that would definitely indicate an error.

from netcdf-cxx4.

Sjurk avatar Sjurk commented on July 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.