freetype2/src/base
Ben Wagner 38272bf853 [ftstroke] Fix invalid pointer assignement to `arc`
In `FT_Stroker_ConicTo` and `FT_Stroker_CubicTo` there is a `bez_stack`.
`arc` is initialized with `arc = bez_stack` and is never set to point
into any different object. The main loop looks like `while ( arc >=
bez_stack )` which is depending on a later `arc -= 2` (or `arc -= 3`) to
make `arc` point to before `bez_stack`. However, using pointer
subtraction to make `arc` point outside the array is undefined behavior,
and attempting to use the value in the loop predicate is "very"
undefined behavior. (C99 "Additive operators" 6.5.6.8.)

This particular undefined behavior was discovered as either hangs or
MemorySantizer issues after "[InstCombine] Infer nuw for gep inbounds
from base of object" [0]. With this change, clang can infer that `arc`
must always point into the `bez_stack` object and therefore cannot be at
a "negative index" so the predicate is always true.

[0] e21ab4d16b

* src/base/ftstroke.c (FT_Stroker_ConicTo, FT_Stroker_CubicTo): test
loop exit condition (there are no more arcs to process) before
decrementing `arc`

Fixes: #1307
2024-12-16 14:39:10 -05:00
..
ftadvanc.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftbase.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftbase.h Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftbbox.c Use unsigned point and contour indexing in `FT_Outline`. 2024-06-20 20:49:56 -04:00
ftbdf.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftbitmap.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftcalc.c Various minor documentation or formatting fixes. 2024-08-12 12:34:28 +02:00
ftcid.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftcolor.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftdbgmem.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftdebug.c Fix various typos. 2024-08-13 23:29:13 -04:00
fterrors.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftfntfmt.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftfstype.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftgasp.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftgloadr.c * src/base/ftgloadr.c (FT_GlyphLoader_Prepare): Minor refactoring. 2024-06-18 21:14:58 -04:00
ftglyph.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftgxval.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
fthash.c * src/base/fthash.c (hash_insert): Avoid unnecessary zeroing. 2022-01-14 18:22:23 +00:00
ftinit.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftlcdfil.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftmac.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftmm.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftobjs.c Move generic destroy to later in the face and size destruction. 2024-10-16 05:08:22 +02:00
ftotval.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftoutln.c Use unsigned tags `FT_Outline`. 2024-06-20 22:16:51 -04:00
ftpatent.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftpfr.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftpsprop.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftrfork.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftsnames.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftstream.c * src/base/ftstream.c (FT_Stream_ReadFields): Switch to `FT_Offset`. 2024-08-05 13:02:04 +00:00
ftstroke.c [ftstroke] Fix invalid pointer assignement to `arc` 2024-12-16 14:39:10 -05:00
ftsynth.c Fix various typos. 2024-08-13 23:29:13 -04:00
ftsystem.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
fttrigon.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
fttype1.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftutil.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
ftver.rc * Version 2.13.3 released. 2024-08-12 12:50:14 +02:00
ftwinfnt.c Update all copyright notices. 2024-01-27 11:11:22 -05:00
md5.c * src/base/md5.c: Updated to recent version. 2016-06-16 06:17:54 +02:00
md5.h * src/base/md5.c, src/base/md5.h: Updated to recent version. 2013-10-22 01:10:10 +02:00
rules.mk Update all copyright notices. 2024-01-27 11:11:22 -05:00