Backport fix of buffer overwrite in png_build_index. DO NOT MERGE
Fixes buffer size calculations to take possible transformations
into account. Images with less than 256 colors in the palette,
that are transformed up to 8-bit, will not overwrite memory at
the end of the buffer. Verified with a 16 color image.
Also fixes some build warnings. This is a cherry-pick of commit
d3ff9df7a1191da1c47710ea8bd568204e74a976.
In addition, this change backports the introduction of
maximum_pixel_depth so that we can use it check sizes correctly.
The alternative is to just use the maximum possible pixel depth,
but that seems like a waste of memory.
bug: 19507636
Signed-off-by: Henrik Smiding <henrik.smiding@intel.com>
Change-Id: Id0b95aac6820302a5b7ed6896de7db6c7c829c2a
4 files changed