From 37cefe33b284d0bad4ec52bcccc1a8c2d8704340 Mon Sep 17 00:00:00 2001 From: Philip Race Date: Thu, 13 Jun 2024 12:01:54 -0700 Subject: [PATCH] * psobjs.c (ps_table_add): Check length before calling `FT_MEM_CPY`. Fixes issue #1280. --- src/psaux/psobjs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index d32f6edf8..eca465f00 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -201,7 +201,9 @@ /* add the object to the base block and adjust offset */ table->elements[idx] = FT_OFFSET( table->block, table->cursor ); table->lengths [idx] = length; - FT_MEM_COPY( table->block + table->cursor, object, length ); + /* length == 0 also implies a NULL destination, so skip the copy call */ + if ( length > 0 ) + FT_MEM_COPY( table->block + table->cursor, object, length ); table->cursor += length; return FT_Err_Ok;