Skip to content

Commit

Permalink
fix(png): Fix crash for writing large PNGs with alpha (AcademySoftwar…
Browse files Browse the repository at this point in the history
…eFoundation#4074)

There was a flaw in PNGOutput::write_scanlines when the y range of
scanlines to write consisted of less than the whole image, and alpha
de-association was needed -- we used the whole-image size instead of the
y range of scanlines size.

Fixes AcademySoftwareFoundation#4044

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz committed Dec 13, 2023
1 parent e2de284 commit 46253cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/png.imageio/pngoutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ PNGOutput::write_scanlines(int ybegin, int yend, int z, TypeDesc format,
unassoc_scratch.reset(new float[nvals]);
float* floatvals = unassoc_scratch.get();
// Contiguize and convert to float
OIIO::convert_image(m_spec.nchannels, m_spec.width, m_spec.height, 1,
OIIO::convert_image(m_spec.nchannels, m_spec.width, yend - ybegin, 1,
data, format, xstride, ystride, AutoStride,
floatvals, TypeFloat, AutoStride, AutoStride,
AutoStride);
Expand Down

0 comments on commit 46253cb

Please sign in to comment.