2009.04.26 17:22 "[Tiff] Packbits worst case encoded length", by Simon Berger

2009.04.30 13:58 "Re: [Tiff] Packbits worst case encoded length", by Toby Thain

On 30-Apr-09, at 3:41 AM, Albert Cahalan wrote:

On Wed, Apr 29, 2009 at 10:28 AM, Toby Thain <toby@telegraphics.com.au> wrote:

On 26-Apr-09, at 1:22 PM, Simon Berger wrote:

(Attribution is incorrect, I wrote the lines you're quoting.)

If you need your code to be robust against corrupt input then you should stop decompressing when the row is full, though of course you will lose sync with the input.

There is no "if".

There must be a lot of code out there that assumes good input. And if you're writing a quick hack, not a general purpose library, you might choose to do the same (hence "if"). Since the RLE code I have written could be used in scavenging a bad file, naturally I used one or more of the strategies you mention.

(Relying on memory protection to save you is not a portable strategy, so again unsuitable for a general purpose library.)



If the row doesn't come out even, you have 4 choices: