[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] those OVERFLOW_* macros and Fontval b69 (Re: Freetype-dev
From: |
Werner LEMBERG |
Subject: |
Re: [ft-devel] those OVERFLOW_* macros and Fontval b69 (Re: Freetype-devel Digest, Vol 149, Issue 5 |
Date: |
Sun, 04 Jun 2017 22:32:12 +0200 (CEST) |
>> Yes and yes. They are ugly, and I wonder whether I should drop the
>> `OVERFLOW_' part of its names to get `SUB_LONG', `ADD_INT32', etc.
>
> Please drop OVERFLOW.
OK.
> I see them as a red flag to rethink the code.
I disagree, at least partially, since...
> The add and sub overflows should not be happening on 32 bits because
> we limit ourselves to 1Gb bitmaps aka 32768x32768. Even at 1/256
> pixel resolution there is plenty of space to avoid overflows.
... rendering is probably the *only* part in FreeType where your
assumption is correct, because we work with absolute point coordinates
in an FT_Outline structure. However, within fonts, almost everything
is stored as coordinate deltas; this means that malformed fonts can
create arbitrarily large values very easily. Ditto for bytecode.
Checking every addition, subtraction or multiplication for overflow is
something I want to avoid, so we have to tag all operations where
overflow can occur.
Werner
- [ft-devel] those OVERFLOW_* macros and Fontval b69 (Re: Freetype-devel Digest, Vol 149, Issue 5, Hin-Tak Leung, 2017/06/04
- Re: [ft-devel] those OVERFLOW_* macros and Fontval b69 (Re: Freetype-devel Digest, Vol 149, Issue 5, Werner LEMBERG, 2017/06/04
- Re: [ft-devel] those OVERFLOW_* macros and Fontval b69 (Re: Freetype-devel Digest, Vol 149, Issue 5, Alexei Podtelezhnikov, 2017/06/04
- Re: [ft-devel] those OVERFLOW_* macros and Fontval b69 (Re: Freetype-devel Digest, Vol 149, Issue 5,
Werner LEMBERG <=
- Re: [ft-devel] those OVERFLOW_* macros and Fontval b69 (Re: Freetype-devel Digest, Vol 149, Issue 5, Alexei Podtelezhnikov, 2017/06/04
- Re: [ft-devel] those OVERFLOW_* macros and Fontval b69 (Re: Freetype-devel Digest, Vol 149, Issue 5, Werner LEMBERG, 2017/06/04
- Re: [ft-devel] those OVERFLOW_* macros and Fontval b69 (Re: Freetype-devel Digest, Vol 149, Issue 5, Markus Trippelsdorf, 2017/06/05
- Re: [ft-devel] those OVERFLOW_* macros and Fontval b69 (Re: Freetype-devel Digest, Vol 149, Issue 5, Werner LEMBERG, 2017/06/06
- Re: [ft-devel] those OVERFLOW_* macros and Fontval b69 (Re: Freetype-devel Digest, Vol 149, Issue 5, Behdad Esfahbod, 2017/06/07
- Re: [ft-devel] those OVERFLOW_* macros and Fontval b69 (Re: Freetype-devel Digest, Vol 149, Issue 5, Werner LEMBERG, 2017/06/07
Re: [ft-devel] those OVERFLOW_* macros and Fontval b69 (Re: Freetype-devel Digest, Vol 149, Issue 5, Alexei Podtelezhnikov, 2017/06/05