SDGenericDataset::readBlock(int blocknum, char **data, size_t &len) not correctly implemented in Azure backends

There is some descrepencies in how this function is implemented in the different backends.

https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-cpp-lib/-/blob/master/src/src/lib/accessors/GcsAccessor.cc#L722

dictates that both data and len are out parameters. On function exit data will point to newly allocated buffer, and len will have the size of the buffer data.

This is implemented in a simmilar manner for AWS here:

https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-cpp-lib/-/blob/master/src/src/lib/cloud/providers/aws/AwsStorage.cc#L453

However, the implementation in both Azure implementations seem to be broken:

https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-cpp-lib/-/blob/master/src/src/lib/cloud/providers/azure/cpprest/AzureStorage.cc#L430

Seems to take the len as a max input parameter, and copy at most len or the objectSize. But it does not expose the objectSize if len > the objectSize.

https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-cpp-lib/-/blob/master/src/src/lib/cloud/providers/azure/curl/AzureStorage.cc#L586

Dereferences the data pointer, which probably points to garbage if it is used according to the other apis. Also it doesn't expose the size of the object either.

For OpenVDS its convenient if this function would allocate a buffer, fill it with the object data en expose the object size through len.

Edited by Jørgen Lind