From d7cf931ac699f6bc0d9d681d78c7a9a488c74449 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 19 May 2024 22:48:13 -0400 Subject: [PATCH] [truetype, type1] Use FT_DUP to duplicate data. * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Use concise FT_DUP. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Ditto. * src/type1/t1load.c (parse_subrs): Ditto. --- src/truetype/ttgload.c | 4 +--- src/truetype/ttgxvar.c | 3 +-- src/type1/t1load.c | 6 ++---- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index df803a0f3..b7d8e1d66 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -418,11 +418,9 @@ /* and thus allocate the bytecode array size by ourselves */ if ( n_ins ) { - if ( FT_QNEW_ARRAY( exec->glyphIns, n_ins ) ) + if ( FT_DUP( exec->glyphIns, p, n_ins ) ) return error; - FT_MEM_COPY( exec->glyphIns, p, (FT_Long)n_ins ); - exec->glyphSize = n_ins; } } diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 7b33b8e52..99a9d4db0 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2722,9 +2722,8 @@ FT_UInt n; - if ( FT_ALLOC( mmvar, ttface->blend->mmvar_len ) ) + if ( FT_DUP( mmvar, ttface->blend->mmvar, ttface->blend->mmvar_len ) ) goto Exit; - FT_MEM_COPY( mmvar, ttface->blend->mmvar, ttface->blend->mmvar_len ); axis_flags = (FT_UShort*)( (char*)mmvar + mmvar_size ); diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 1704d1375..ee7fb42a5 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -1877,9 +1877,8 @@ } /* t1_decrypt() shouldn't write to base -- make temporary copy */ - if ( FT_QALLOC( temp, size ) ) + if ( FT_DUP( temp, base, size ) ) goto Fail; - FT_MEM_COPY( temp, base, size ); psaux->t1_decrypt( temp, size, 4330 ); size -= (FT_ULong)t1face->type1.private_dict.lenIV; error = T1_Add_Table( table, @@ -2091,9 +2090,8 @@ } /* t1_decrypt() shouldn't write to base -- make temporary copy */ - if ( FT_QALLOC( temp, size ) ) + if ( FT_DUP( temp, base, size ) ) goto Fail; - FT_MEM_COPY( temp, base, size ); psaux->t1_decrypt( temp, size, 4330 ); size -= (FT_ULong)t1face->type1.private_dict.lenIV; error = T1_Add_Table( code_table,