freetype/src
Ben Wagner 0d4f887c79 [base] Always close user-provided stream.
The `FT_Open_Face` documentation states

> If `FT_OPEN_STREAM` is set in `args->flags`, the stream in `args->stream`
> is automatically closed before this function returns any error (including
> `FT_Err_Invalid_Argument`).

However, if the user provides a stream in `args.stream` with
`FT_OPEN_STREAM` set and a `close` function, but then for some reason passes
NULL for `aface` and a non-negative `face_index`, the error
`Invalid_Argument` is returned but the `close` callback will not be called
on the user-provided stream.  This may cause resource leaks if the caller is
depending on the `close` callback to free resources.

The difficulty is that a user may fill out a `FT_StreamRec` and pass its
address as `args.stream`, but the stream isn't really 'live' until
`FT_Stream_New` is called on it (and `memory` is set).  In particular, it
cannot really be cleaned up properly in `ft_open_face_internal` until the
stream pointer has been copied into the `stream` local variable.

* src/base/ftobj.c (ft_open_face_internal): Ensure that user-provided
`args.stream.close` is called even with early errors.
2023-01-17 08:54:11 +01:00
..
autofit sr/*.c: Various minor fixes. 2023-01-16 16:38:56 +01:00
base [base] Always close user-provided stream. 2023-01-17 08:54:11 +01:00
bdf [bdf, pfr, psnames] Accelarate charmap searches. 2022-11-06 13:12:47 -05:00
bzip2 Whitespace. 2022-04-01 08:50:33 +02:00
cache * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Avoid FT_Set_Charmap. 2022-10-03 17:13:30 +00:00
cff [cff, truetype] Simplify SVG metrics scaling. 2022-10-21 12:14:52 +00:00
cid Update all copyright notices. 2022-01-11 10:54:10 +01:00
dlg Update all copyright notices. 2022-01-11 10:54:10 +01:00
gxvalid sr/*.c: Various minor fixes. 2023-01-16 16:38:56 +01:00
gzip sr/*.c: Various minor fixes. 2023-01-16 16:38:56 +01:00
lzw * src/lzw/ftzopen.c (ft_lzwstate_stack_grow): Cosmetic macro change. 2022-06-11 23:47:19 -04:00
otvalid * src/otvalid/otvgsub.c (otv_SingleSubst_validate): Fix format 1 handling. 2022-09-15 09:14:06 +02:00
pcf Comments added. 2022-11-18 14:03:19 +00:00
pfr * src/pfr/pfrsbit.c (pfr_lookup_bitmap_data): Accelerate the search. 2022-11-07 21:36:32 -05:00
psaux [psaux] Delay the upem validity assertion. 2022-12-20 16:38:39 +00:00
pshinter Fix clang++ warnings. 2022-03-31 07:49:35 +02:00
psnames [bdf, pfr, psnames] Accelarate charmap searches. 2022-11-06 13:12:47 -05:00
raster Whitespace. 2022-04-01 08:50:33 +02:00
sdf [sdf, sfnt] Handle minor compiler warnings. 2022-12-13 09:53:26 +01:00
sfnt sr/*.c: Various minor fixes. 2023-01-16 16:38:56 +01:00
smooth [smooth] Fix GCC LTO crashes on Windows. 2022-06-10 11:34:56 -04:00
svg * src/svg/ftsvg.c (ft_svg_property_set): Disallow NULL pointers. 2022-01-23 19:05:15 +01:00
tools * src/tools/*.py: Migrate to Python 3. 2022-09-28 22:35:49 -04:00
truetype [sfnt] Remove temporary runtime flag for variable 'COLR' v1. 2023-01-16 14:02:36 +01:00
type1 * src/type1/t1afm.c (T1_Read_PFM): Set charmaps directly. 2022-10-03 19:18:48 -04:00
type42 Whitespace. 2022-04-01 08:50:33 +02:00
winfonts Whitespace. 2022-04-01 08:50:33 +02:00