wvanbergen / chunky_png

Read/write access to PNG images in pure Ruby.
https://chunkypng.com
MIT License
1.05k stars 101 forks source link

Fix reading streams with trailing data #111

Closed wvanbergen closed 8 years ago

wvanbergen commented 8 years ago

Stop reading from a stream after the IEND chunk has been seen, instead of until the EOF of the stream. This prevents a stream with trailing data to raise an exception failed error.

According to the PNG spec: "The IEND chunk marks the end of the PNG datastream.". So i think it is fair to stop reading once we have seen it.

Fixes #96. FYI @whoisjake @ebds

@rrjamie @lencioni Does this make sense?

lencioni commented 8 years ago

Makes sense to me

On Sun, Jun 19, 2016, 4:40 AM Willem van Bergen notifications@github.com wrote:

Stop reading from a stream after the IEND chunk has been seen, instead of until the EOF of the stream. This prevents a stream with trailing data to raise an exception failed error.

According to the PNG spec: "The IEND chunk marks the end of the PNG datastream.". So i think it is fair to stop reading once we have seen it.

Fixes #96 https://github.com/wvanbergen/chunky_png/issues/96. FYI @whoisjake https://github.com/whoisjake @ebds https://github.com/ebds

@rrjamie https://github.com/rrjamie @lencioni

https://github.com/lencioni Does this make sense?

You can view, comment on, or merge this pull request online at:

https://github.com/wvanbergen/chunky_png/pull/111 Commit Summary

  • Stop reading from a stream after the IEND chunk has been seen, instead of until EOF. This prevents a stream with trailing data to raise an exception failed error.

File Changes

Patch Links:

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wvanbergen/chunky_png/pull/111, or mute the thread https://github.com/notifications/unsubscribe/AAL7zvEGFrOdHGTe76fijFfl0c4pJDV_ks5qNSqwgaJpZM4I5JZL .