summaryrefslogtreecommitdiff
path: root/pngrtran.c
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2015-09-23 22:08:04 -0500
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2015-09-23 22:08:04 -0500
commitefe4e5d10d3afc5983cdd7733f8d38f855ed3f9b (patch)
treee89520a7f47a1bb2ad9764a758d37fd2a131253d /pngrtran.c
parentd6eb4b71aceb7d6059b58180332d7b71ed71d0c2 (diff)
[libpng16] Reverted the fix of byte order in png_do_read_filler() with 16-bit
input that was made in version 1.6.17beta01, to preserve legacy behavior even though it was incorrect. Instead, added new API png_set_filter_16() and png_set_add_alpha_16() that set a flag to make png_do_read_filter() interpret the filler bytes properly.
Diffstat (limited to 'pngrtran.c')
-rw-r--r--pngrtran.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/pngrtran.c b/pngrtran.c
index 284226aeb..208f4ceab 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -2660,10 +2660,17 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
png_uint_32 i;
png_uint_32 row_width = row_info->width;
+ png_byte lo_filler = (png_byte)filler;
+
#ifdef PNG_READ_16BIT_SUPPORTED
png_byte hi_filler = (png_byte)(filler>>8);
+ if (((flags & PNG_FLAG_FILLER_16) == 0) && row_info->bit_depth == 16)
+ {
+ /* filler bytes were read in the wrong order prior to libpng-1.5.24 */
+ lo_filler = hi_filler;
+ hi_filler = (png_byte)filler;
+ }
#endif
- png_byte lo_filler = (png_byte)filler;
png_debug(1, "in png_do_read_filler");