You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current v2.0 API uses the XML metadata read from the BAG file to set the shape (dimensions) in BAG::Descriptor as returned by getDims(). This should, in theory, be the shape of the Elevation and Uncertainty mandatory layers (as long as the metadata is valid).
However, it is possible for optional layers to be of different shapes. The variable resolution refinement and node layers are a particular example of this: although the VR metadata has the same shape as the mandatory layers, the refinements and nodes are stored as a one-dimensional array (with indices in the metadata element for each fixed-resolution node).
The code in BAG::Layer::read() (advisedly) checks the size of the read request against the shape to avoid out-of-bounds requests, but although it has a BAG::LayerDescriptor for the layer, it uses the BAG::Descriptor for dimensions (because the BAG::LayerDescriptor doesn't have dimensions for the individual layer). This means that if the optional layer doesn't have the same shape as the metadata describes, then the code may fail with a BAG::InvalidReadSize exception for valid reads.
To fix this:
The BAG::LayerDescriptor object needs to have row/col parameters for the shape of the layer, as read from the HDF5 file.
The BAG::LayerDescriptor object must have a getDims() method to return this information.
The layer constructor must populate the shape parameters in BAG::LayerDescriptor at construction.
The BAG::Layer::read() helper must validate the read shape against the BAG::LayerDescriptor rather than the BAG::Descriptor.
The text was updated successfully, but these errors were encountered:
The current v2.0 API uses the XML metadata read from the BAG file to set the shape (dimensions) in BAG::Descriptor as returned by getDims(). This should, in theory, be the shape of the Elevation and Uncertainty mandatory layers (as long as the metadata is valid).
However, it is possible for optional layers to be of different shapes. The variable resolution refinement and node layers are a particular example of this: although the VR metadata has the same shape as the mandatory layers, the refinements and nodes are stored as a one-dimensional array (with indices in the metadata element for each fixed-resolution node).
The code in BAG::Layer::read() (advisedly) checks the size of the read request against the shape to avoid out-of-bounds requests, but although it has a BAG::LayerDescriptor for the layer, it uses the BAG::Descriptor for dimensions (because the BAG::LayerDescriptor doesn't have dimensions for the individual layer). This means that if the optional layer doesn't have the same shape as the metadata describes, then the code may fail with a BAG::InvalidReadSize exception for valid reads.
To fix this:
The text was updated successfully, but these errors were encountered: