Hi,
I'm trying to upgrade Android's aging libpng 1.2.46 to 1.5.10 and I'm
running into a nasty issue. I'm particularly running into a problem
while running a tool in Android on x86 called aapt, which can be thought
of as a resource packager which uses PNG's writing ability to make a
huge binary asset. I was able to get the code to compile without any
issues on all versions of libpng (1.2, 1.4, 1.5) and it works fine with
the default config for 1.2 and 1.4 but fails on 1.5 with an "internal
write transform logic error".
I debugged the code a little bit and saw that it is failing because I'm
failing the test:
(row_info.pixel_depth != png_ptr->pixel_depth)
Given:
row_info->{colortype=2, width=46, channels=3, bit_depth=8,
pixel_depth=24, row_bytes=138}
png_ptr ->{colortype=6, width=46, channels=4, bit_depth=8,
pixel_depth=32, row_bytes=184}
I do have a "filler" transformation on my source data to remove the
alpha channel which explains how row_info started off to be the same as
png_ptr, but was switched to having one less channel. I can't really
think of a way to pass the above-mentioned test with a filler
transformation. Is this a bug in libpng or is aapt using the library
incorrectly and this path that used to work no longer does for a good
reason?
IIRC we saw this error when trying the same upgrade in Linaro, but
I can't remember what the conclusion was. Maybe someone on the
linaro-android list can help.