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

John Bowler <[email protected]>
Newsgroups gmane.comp.graphics.png.devel
Message-ID <CAP7U39-Q-+GOryQQch1nQppTzvgjx0Yhf9WayUpuUbaE_tN13w@mail.gmail.com>
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.

John Bowler

------------------------------------------------------------------------------
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.