external/freetype/ubsan.patch |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit 9d4627322f5e2753b29cc310f1da9e433d986ae7
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Nov 17 16:54:09 2022 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Nov 22 14:28:05 2022 +0100

    exteral/freetype: -fsanitize=non-null-attribute
    
    Crashreport log:
    
    workdir/UnpackedTarball/freetype/src/psaux/psobjs.c:204:5: runtime error: 
null pointer passed as argument 1, which is declared to never be null
    /usr/include/string.h:44:28: note: nonnull attribute specified here
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
                   workdir/UnpackedTarball/freetype/src/psaux/psobjs.c:204:5 in
    
    Change-Id: Ib2ae396ba640129a8bc1c937ce41a38b6279a2ae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143098
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/external/freetype/ubsan.patch b/external/freetype/ubsan.patch
index c8173eeff531..62d31f5d3be9 100644
--- a/external/freetype/ubsan.patch
+++ b/external/freetype/ubsan.patch
@@ -9,3 +9,15 @@
  
      /* outer loop steps through master designs to be blended */
      for ( master = 0; master < varData->regionIdxCount; master++ )
+--- src/psaux/psobjs.c.orig    2022-11-17 16:52:21.913211573 +0100
++++ src/psaux/psobjs.c 2022-11-17 16:53:17.905127207 +0100
+@@ -201,7 +201,8 @@
+     /* 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 );
++    if (table->block + table->cursor)
++      FT_MEM_COPY( table->block + table->cursor, object, length );
+ 
+     table->cursor += length;
+     return FT_Err_Ok;

Reply via email to