mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 18:25:58 +00:00
[FREETYPE] Handle allocation failures in our stack-saving hacks. CORE-15642
Running out of pool is likely at least during kmtest:ExPools. There is a chance of crashing when dereferencing these null pointers -- but worse, there's also a chance of overwriting the IVT or BDA if a VDM BIOS call is in progress, which can lead to crashes in non-obvious places later.
This commit is contained in:
parent
e2d8e588bb
commit
64d48843d7
8 changed files with 49 additions and 1 deletions
|
@ -73,6 +73,7 @@
|
||||||
/* scan the array of segments in each direction */
|
/* scan the array of segments in each direction */
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
AF_GlyphHintsRec *hints = malloc(sizeof(AF_GlyphHintsRec));
|
AF_GlyphHintsRec *hints = malloc(sizeof(AF_GlyphHintsRec));
|
||||||
|
if (!hints) return;
|
||||||
#else
|
#else
|
||||||
AF_GlyphHintsRec hints[1];
|
AF_GlyphHintsRec hints[1];
|
||||||
#endif
|
#endif
|
||||||
|
@ -95,6 +96,9 @@
|
||||||
int dim;
|
int dim;
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
AF_CJKMetricsRec *dummy = malloc(sizeof(AF_CJKMetricsRec));
|
AF_CJKMetricsRec *dummy = malloc(sizeof(AF_CJKMetricsRec));
|
||||||
|
if (!dummy)
|
||||||
|
goto Exit;
|
||||||
|
{
|
||||||
#else
|
#else
|
||||||
AF_CJKMetricsRec dummy[1];
|
AF_CJKMetricsRec dummy[1];
|
||||||
#endif
|
#endif
|
||||||
|
@ -274,6 +278,7 @@
|
||||||
}
|
}
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
free(dummy);
|
free(dummy);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
/* scan the array of segments in each direction */
|
/* scan the array of segments in each direction */
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
AF_GlyphHintsRec *hints = malloc(sizeof(AF_GlyphHintsRec));
|
AF_GlyphHintsRec *hints = malloc(sizeof(AF_GlyphHintsRec));
|
||||||
|
if (!hints) return;
|
||||||
#else
|
#else
|
||||||
AF_GlyphHintsRec hints[1];
|
AF_GlyphHintsRec hints[1];
|
||||||
#endif
|
#endif
|
||||||
|
@ -86,6 +87,9 @@
|
||||||
int dim;
|
int dim;
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
AF_LatinMetricsRec *dummy = malloc(sizeof(AF_LatinMetricsRec));
|
AF_LatinMetricsRec *dummy = malloc(sizeof(AF_LatinMetricsRec));
|
||||||
|
if (!dummy)
|
||||||
|
goto Exit;
|
||||||
|
{
|
||||||
#else
|
#else
|
||||||
AF_LatinMetricsRec dummy[1];
|
AF_LatinMetricsRec dummy[1];
|
||||||
#endif
|
#endif
|
||||||
|
@ -267,6 +271,7 @@
|
||||||
}
|
}
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
free(dummy);
|
free(dummy);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -552,6 +552,11 @@
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
AF_GlyphHintsRec *hints = malloc(sizeof(AF_GlyphHintsRec));
|
AF_GlyphHintsRec *hints = malloc(sizeof(AF_GlyphHintsRec));
|
||||||
AF_LoaderRec *loader = malloc(sizeof(AF_LoaderRec));
|
AF_LoaderRec *loader = malloc(sizeof(AF_LoaderRec));
|
||||||
|
if (!hints || !loader)
|
||||||
|
{
|
||||||
|
error = FT_Err_Out_Of_Memory;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
AF_GlyphHintsRec hints[1];
|
AF_GlyphHintsRec hints[1];
|
||||||
AF_LoaderRec loader[1];
|
AF_LoaderRec loader[1];
|
||||||
|
@ -570,6 +575,7 @@
|
||||||
af_glyph_hints_done( hints );
|
af_glyph_hints_done( hints );
|
||||||
|
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
|
Exit:
|
||||||
free(hints);
|
free(hints);
|
||||||
free(loader);
|
free(loader);
|
||||||
#endif
|
#endif
|
||||||
|
|
3
sdk/lib/3rdparty/freetype/src/cid/cidgload.c
vendored
3
sdk/lib/3rdparty/freetype/src/cid/cidgload.c
vendored
|
@ -343,8 +343,10 @@
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
|
T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
|
||||||
|
if (!decoder) return FT_Err_Out_Of_Memory;
|
||||||
/* Ugly but it allows us to reduce the diff */
|
/* Ugly but it allows us to reduce the diff */
|
||||||
#define decoder (*decoder)
|
#define decoder (*decoder)
|
||||||
|
{
|
||||||
#else
|
#else
|
||||||
T1_DecoderRec decoder;
|
T1_DecoderRec decoder;
|
||||||
#endif
|
#endif
|
||||||
|
@ -533,6 +535,7 @@
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
free(&decoder);
|
free(&decoder);
|
||||||
#undef decoder
|
#undef decoder
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -527,6 +527,7 @@
|
||||||
CF2_HintMaskRec hintMask;
|
CF2_HintMaskRec hintMask;
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
CF2_GlyphPathRec *glyphPath = malloc(sizeof(CF2_GlyphPathRec));
|
CF2_GlyphPathRec *glyphPath = malloc(sizeof(CF2_GlyphPathRec));
|
||||||
|
if (!glyphPath) return;
|
||||||
/* Ugly but it allows us to reduce the diff */
|
/* Ugly but it allows us to reduce the diff */
|
||||||
#define glyphPath (*glyphPath)
|
#define glyphPath (*glyphPath)
|
||||||
#else
|
#else
|
||||||
|
@ -2613,12 +2614,18 @@
|
||||||
*/
|
*/
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
CF2_HintMapRec *counterHintMap = malloc(sizeof(CF2_HintMapRec));
|
CF2_HintMapRec *counterHintMap = malloc(sizeof(CF2_HintMapRec));
|
||||||
|
CF2_HintMaskRec counterMask;
|
||||||
|
if (!counterHintMap)
|
||||||
|
{
|
||||||
|
lastError = FT_Err_Out_Of_Memory;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
/* Ugly but it allows us to reduce the diff */
|
/* Ugly but it allows us to reduce the diff */
|
||||||
#define counterHintMap (*counterHintMap)
|
#define counterHintMap (*counterHintMap)
|
||||||
#else
|
#else
|
||||||
CF2_HintMapRec counterHintMap;
|
CF2_HintMapRec counterHintMap;
|
||||||
#endif
|
|
||||||
CF2_HintMaskRec counterMask;
|
CF2_HintMaskRec counterMask;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
cf2_hintmap_init( &counterHintMap,
|
cf2_hintmap_init( &counterHintMap,
|
||||||
|
|
|
@ -3208,6 +3208,12 @@
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
worker = malloc(sizeof(black_TWorker));
|
worker = malloc(sizeof(black_TWorker));
|
||||||
buffer = malloc(FT_MAX(FT_RENDER_POOL_SIZE, 2048));
|
buffer = malloc(FT_MAX(FT_RENDER_POOL_SIZE, 2048));
|
||||||
|
if (!worker || !buffer)
|
||||||
|
{
|
||||||
|
free(worker);
|
||||||
|
free(buffer);
|
||||||
|
return FT_THROW( Out_Of_Memory );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ras.outline = *outline;
|
ras.outline = *outline;
|
||||||
|
|
|
@ -1757,6 +1757,10 @@ typedef ptrdiff_t FT_PtrDist;
|
||||||
|
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
buffer = malloc(FT_MAX(FT_RENDER_POOL_SIZE, 2048));
|
buffer = malloc(FT_MAX(FT_RENDER_POOL_SIZE, 2048));
|
||||||
|
if (!buffer)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* set up vertical bands */
|
/* set up vertical bands */
|
||||||
|
|
12
sdk/lib/3rdparty/freetype/src/type1/t1gload.c
vendored
12
sdk/lib/3rdparty/freetype/src/type1/t1gload.c
vendored
|
@ -215,6 +215,9 @@
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
|
T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
|
||||||
|
if (!decoder)
|
||||||
|
return FT_THROW( Out_Of_Memory );
|
||||||
|
{
|
||||||
/* Ugly but it allows us to reduce the diff */
|
/* Ugly but it allows us to reduce the diff */
|
||||||
#define decoder (*decoder)
|
#define decoder (*decoder)
|
||||||
#else
|
#else
|
||||||
|
@ -279,6 +282,7 @@
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
free(&decoder);
|
free(&decoder);
|
||||||
#undef decoder
|
#undef decoder
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return FT_Err_Ok;
|
return FT_Err_Ok;
|
||||||
}
|
}
|
||||||
|
@ -294,8 +298,11 @@
|
||||||
T1_Face face = (T1_Face)t1face;
|
T1_Face face = (T1_Face)t1face;
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
|
T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
|
||||||
|
if (!decoder)
|
||||||
|
return FT_THROW( Out_Of_Memory );
|
||||||
/* Ugly but it allows us to reduce the diff */
|
/* Ugly but it allows us to reduce the diff */
|
||||||
#define decoder (*decoder)
|
#define decoder (*decoder)
|
||||||
|
{
|
||||||
#else
|
#else
|
||||||
T1_DecoderRec decoder;
|
T1_DecoderRec decoder;
|
||||||
#endif
|
#endif
|
||||||
|
@ -358,6 +365,7 @@
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
free(&decoder);
|
free(&decoder);
|
||||||
#undef decoder
|
#undef decoder
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return FT_Err_Ok;
|
return FT_Err_Ok;
|
||||||
}
|
}
|
||||||
|
@ -373,8 +381,11 @@
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
|
T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
|
||||||
|
if (!decoder)
|
||||||
|
return FT_THROW( Out_Of_Memory );
|
||||||
/* Ugly but it allows us to reduce the diff */
|
/* Ugly but it allows us to reduce the diff */
|
||||||
#define decoder (*decoder)
|
#define decoder (*decoder)
|
||||||
|
{
|
||||||
#else
|
#else
|
||||||
T1_DecoderRec decoder;
|
T1_DecoderRec decoder;
|
||||||
#endif
|
#endif
|
||||||
|
@ -629,6 +640,7 @@
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
free(&decoder);
|
free(&decoder);
|
||||||
#undef decoder
|
#undef decoder
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue