Andrew Brygin wrote: > yes, I agree that the reaching the length limit likely signifies that > png header is corrupt. Our usual policy is to try to be tolerant to > errors in the images. There are too many not very well formed images > around and being too strict we may reject too much. That's why I am > inclined to avoid throwing exception.
A malformed string will in almost all cases render the current chunk unusable. So as an alternative, you could throw a (newly introduced) MalformedChunkException and catch such an exception in the loop iterating over the chunks. This way, overlong strings and the resulting loss of synchronization could never lead to the allocation of unreasonable amounts of data or similar issue, as the broken chunk would be aborted cleanly. Just an idea. Greetings, Martin
signature.asc
Description: OpenPGP digital signature