Re: Fwd: [glennrp/libpng] Undefined behaviour in pngutil.c (#149)

Glenn Randers-Pehrson <[email protected]>
Newsgroups gmane.comp.graphics.png.devel
Message-ID <CA+PdXcv=o9aKx3ZjbtuLDmrcfV=3M+vKOs4F0v7mNmCwAi2aHQ@mail.gmail.com>
On Mon, Jan 2, 2017 at 10:36 PM, John Bowler <
[email protected]> wrote:

> On Mon, Jan 2, 2017 at 4:40 PM, Glenn Randers-Pehrson <[email protected]>
> wrote:
>
>> This bug report is correct.
>>
>
> Yes, tricky maintainer feature; the 'options' field is entirely internal
> so can be changed in maintenance releases.  Doing this does, I think, work:
>
> unsigned option : PNG_OPTION_LAST * 2;
>
> (I didn't check the current code, but something along those lines will
> work.)
>
> That means the compiler will barf if PNG_OPTION_LAST ever gets set to
> something out of range for the base type and therefore guarantees that
> neither the undefined behavior nor the current result (the new option is
> always off) happens.
>

libpng17 is better anyhow; the "options" member is gone and replaced with
individual "png_ptr->someflag" bytes.

Glenn

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

_______________________________________________
png-mng-implement mailing list
png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.