Re: [hackers] [farbfeld] Remove dimension checks || FRIGN

From: FRIGN <dev_AT_frign.de>
Date: Mon, 11 Apr 2016 19:58:31 +0200

On Sun, 10 Apr 2016 23:49:49 +0100
Dimitris Papastamos <sin_AT_2f30.org> wrote:

Hey Dimitris,

> One problem I see with this approach is that an error will potentially go
> unnoticed and require more time to diagnose than necessary.

it's the same debate as with UTF-parsers and how liberal they should be
with input data.
From my experience, being liberal with input sounds nice in theory, but
really can lead to slacky and broken code in practice. If garbage is fed
to the farbfeld tools, I really cannot stress this enough, we will try
to work with the garbage as far as possible.
And given farbfeld explicitly allows 0x0 pixel images (and 0x3 for that
matter), we accept it as input. Are these dimensions useful? Nah, but
they are legal and that's why I don't want to error out prematurely.
I think it's better to let the image libraries handle this case.

What we _could_ do is error out and say
        "libpng does not support zero dimension images"
however, this would be a statement based on one current version of libpng,
and we cannot predict how the format will develop.
The png_set_iHDR-function will error out if we pass bad data to it, so why
bother in the main code?

Cheers

FRIGN

-- 
FRIGN <dev_AT_frign.de>
Received on Mon Apr 11 2016 - 19:58:31 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 11 2016 - 20:00:16 CEST