freetype2/src
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
..
autofit Fix various typos. 2024-08-13 23:29:13 -04:00
base [ftstroke] Fix invalid pointer assignement to `arc` 2024-12-16 14:39:10 -05:00
bdf [bdf,pcf,winfonts,sfnt] Remove barely used marcros. 2024-07-28 19:42:49 -04:00
bzip2 Update all copyright notices. 2024-01-27 11:11:22 -05:00
cache * src/*/*: Fix C++ compilation; fix clang warnings. 2024-08-12 12:34:28 +02:00
cff [cff] Fix leak of cmap data 2024-12-04 16:55:10 -05:00
cid Avoid n^2 scanning for binary data. 2024-03-08 17:47:43 +01:00
dlg Update all copyright notices. 2024-01-27 11:11:22 -05:00
gxvalid Update all copyright notices. 2024-01-27 11:11:22 -05:00
gzip Update all copyright notices. 2024-01-27 11:11:22 -05:00
lzw Update all copyright notices. 2024-01-27 11:11:22 -05:00
otvalid Update all copyright notices. 2024-01-27 11:11:22 -05:00
pcf [bdf,pcf,winfonts,sfnt] Remove barely used marcros. 2024-07-28 19:42:49 -04:00
pfr Use unsigned tags `FT_Outline`. 2024-06-20 22:16:51 -04:00
psaux * src/*/*: Fix C++ compilation; fix clang warnings. 2024-08-12 12:34:28 +02:00
pshinter Use unsigned tags `FT_Outline`. 2024-06-20 22:16:51 -04:00
psnames Update all copyright notices. 2024-01-27 11:11:22 -05:00
raster Use unsigned tags `FT_Outline`. 2024-06-20 22:16:51 -04:00
sdf Fix various typos. 2024-08-13 23:29:13 -04:00
sfnt * src/sfnt/ttsbit.c (tt_face_load_sbix_image): Respect metrics_only. 2024-09-07 13:44:57 -04:00
smooth * src/smooth/ftgrays.c (gray_convert_glyph): Clear stack pointers. 2024-10-13 12:14:43 -04:00
svg Update all copyright notices. 2024-01-27 11:11:22 -05:00
tools apinames: Fix a buffer overrun for VMS platform. 2024-10-13 21:18:47 +09:00
truetype * src/truetype/ttgload.c (load_truetype_glyph): Rearrange. 2024-10-14 11:47:31 +00:00
type1 [truetype, type1] Use FT_DUP to duplicate data. 2024-05-19 22:48:13 -04:00
type42 Update all copyright notices. 2024-01-27 11:11:22 -05:00
winfonts * src/winfonts/winfnt.c (fnt_face_get_dll_font): Unwrap arithmetic. 2024-08-01 21:15:46 -04:00