Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSingleChannelTileAccessor::Get() returns uninitialized memory #93

Open
lschr opened this issue Jan 3, 2024 · 0 comments
Open

CSingleChannelTileAccessor::Get() returns uninitialized memory #93

lschr opened this issue Jan 3, 2024 · 0 comments

Comments

@lschr
Copy link

lschr commented Jan 3, 2024

Describe the bug
CSingleChannelTileAccessor::Get (and probably also the other accessor implementations) returns uninitialized memory if called with pOptions=nullptr or if passing ISingleChannelTileAccessor::Options where backGroundColor has not been set to finite values explicitly. (Note that ISingleChannelTileAccessor::Options::Clear() sets the backGroundColor values to NaN.)

The reason is that CSingleChannelAccessorBase::Clear(), which is called by CSingleChannelTileAccessor::InternalGet() , only fills the bitmap if all values of backGroundColor are not NaN.

To Reproduce

auto reader = libCZI::CreateCZIReader();
reader->open(/* some stream */);
auto accessor = reader->CreateSingleChannelTileAccessor();
libCZI::CDimCoordinate coord;
// set some coordinates
auto bitmap = accessor->Get(/* some ROI which is not fully covered by tiles */, &coords, nullptr);
auto lock_info = bitmap->Lock();
// enjoy random values in regions not covered by tiles
bitmap->Unlock();

Expected behavior
Background pixels are initialized with a predictable value by default.

Desktop (please complete the following information):

  • OS: Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant