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

[image output] Initialize pixels of partial tile conversion buffer. #4462

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/libOpenImageIO/imageoutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,13 @@ ImageOutput::write_tiles(int xbegin, int xend, int ybegin, int yend, int zbegin,
ok &= write_tile(x, y, z, format, tilestart, xstride,
ystride, zstride);
} else {
if (!buf.get())
buf.reset(new char[pixelsize * m_spec.tile_pixels()]);
if (!buf.get()) {
const size_t sz = pixelsize * m_spec.tile_pixels();
buf.reset(new char[sz]);
// Not all pixels will be initialized, so we set them to zero here.
// This will avoid generation of NaN, FPEs and valgrind errors.
memset(buf.get(), 0, sz);
}
OIIO::copy_image(m_spec.nchannels, xw, yh, zd, tilestart,
pixelsize, xstride, ystride, zstride,
&buf[0], pixelsize,
Expand Down
Loading