devongovett / png-stream

A streaming PNG encoder and decoder
29 stars 4 forks source link

Don't use divisibility by 4 to determine if palette contains transparency. #3

Open damellis opened 8 years ago

damellis commented 8 years ago

A non-alpha palette may have an even multiple of four colors, causing it to be divisible by four even though it doesn't contain alpha values. So the code in encoder.js (lines 179 to 192) will erroneously move some of the palette bytes into the alpha palette, breaking the palette.