libpng
libpng copied to clipboard
Skip reassignment of the initialization value
This was incorrect: Reversed condition changed to
Reassignment of the same value is a common kind of copy-paste errors.
Hence static analysis emits warning in this case.
A better way to avoid reassignment is in the updated commit.less
instead of less or equal
because the value still should be PNG_UINT_31_MAX
.
Thanks for reviewing. I changed the code and the description in the first message.
libpng-ng comment: libpng(ng) shouldn't even contain this code for IDAT There is no point detecting an over-long IDAT unless it exceeds the PNG spec length (indicating a corrupted stream). IDAT buffering needs to be controlled internally to optimize the specific zlib implementation (if known) and the architecture performance; small buffers or large buffers depend on the relative speed of the zlib window copy vs the libpng row handling for large images and for small images the code can avoid the window copy entirely if enough is known about the zlib implementation.
As could be read, at least one more version of 1.6 was planned. So this code might stay for some time, while 1.7 branch did not pan out.
PS. About 5 years ago in one discussion it was suggested to rename libspng
to libpng-ng
. It did not happen.