Comments (6)
png_read_info succeeds, even though there is no IDAT chunk, and then png_read_row ends up in an infinite loop reading faked 0-length IDAT chunks. pngfix should be issuing a png_error when the read fails before the first IDAT.
from libpng.
Wrong: I believed pngcheck (well, OK, I didn't pass '-f' and apparently it aborts the read on a CRC error). There are IDAT chunks. In hangs/1.hangs:
Signature
IHDR (1x1 PNG)
bKGD (valid)
pHYS (valid, but with a bad CRC)
IDAT (length 0, bad CRC)
IDAT (length 131072, truncated)
The truncated IDAT does actually contain something that sort-of looks like IEND, but basically it is truncated.
I think the problem is that pngfix isn't handling a zero-length IDAT; it goes into an infinite loop. I thought this had been fixed, but maybe the fixes were only in libpng.
from libpng.
The error occurs in the writing of the IDAT chunks. An easy work-round is to give the '--max' option, then the writing re-chunks the input IDATs and the zero length one doesn't cause a problem. This works for all the examples (well, it 'fixes' the IDAT stream; there are other errors which pngfix doesn't fix and isn't intended to fix.)
from libpng.
The code in rechunk_length is using idat_index == 0 for two different thing; indicating the first call to rechunk_length and indicating the end of a 0 length IDAT. This does not work of course. I've changed it to take the appropriate extra parameter and this seems to fix the problem. Unfortunately at the moment my ISP is down, so it may be a while before I can send the patch. It's trivial but definitely needs pre-rc review/test.
from libpng.
The following patch fixes all the hangs:
Please test; the logic of handling the rewrite of the PNG stream has changed very slightly but this may be enough to introduce more bugs. (It looks totally safe, but then this kind of change always does.) BTW I am pretty sure that the bug triggers on any PNG with a zero length IDAT anywhere; the pngfix code can't get beyond the first such chunk.
from libpng.
Pushed to the libpng16 and libpng17 branches of glennrp/libpng.
from libpng.
Related Issues (20)
- Need to restore STDERR in pngtest.c HOT 3
- 16-bit channels, possible issue? HOT 7
- Minor Syntax Issues in the `/libpng/contrib/gregbook` HOT 1
- Possible integer overflow in pngtests.c HOT 2
- Implicit fallthroughs HOT 8
- libpng version 1.6.43 dll only worked on the debugged version.crashed with the released version. HOT 3
- [Build][CMake][Windows] Issue to build on Windows when cygwin (awk ) is present in the PATH HOT 4
- libpng-1.6.43.tar.gz is corrupt HOT 2
- Sovereign Tech Fund: Fellowship for Maintainers
- Potential Vulnerability in libpng Leading to Hang or Infinite Loop when Processing Malformed PNG Files HOT 4
- png_set_cHRM() fails when using ACEScg coordinates HOT 16
- Using ZSTD for compression in PNG HOT 2
- SECURITY: possible integer overflow with some cHRM chunk values HOT 13
- [libpng18] spurious autoconf files HOT 4
- [libpng18] < 10700, not quite complete HOT 3
- libpng-1.6.44 fails to compile with gcc 14 on armv7 target HOT 3
- aarch64-linux-gnu-gcc Cross-compile won't work HOT 2
- Cmake: build using FetchContent
- Borland C compiler doesn't like `randomize` in pngvalid.c HOT 5
- BUILD BREAK: arm/palette_neon_intrinsics.c fails to compile with -Wcast-align HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libpng.