* psobjs.c (ps_table_add): Check length before calling `FT_MEM_CPY`.

Fixes issue #1280.
This commit is contained in:
Philip Race 2024-06-13 12:01:54 -07:00 committed by Werner Lemberg
parent 2280346192
commit 37cefe33b2
1 changed files with 3 additions and 1 deletions

View File

@ -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;