external/freetype/ubsan.patch |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5c85fc8552e8ce811833351b68b3d70b9bb6bf4f
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed Nov 23 08:13:44 2022 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Nov 23 09:06:33 2022 +0100

    exteral/freetype: improve -fsanitize=non-null-attribute fix
    
    Quoting 
<https://gerrit.libreoffice.org/c/core/+/143098/2#message-62ac4499370dd88eeb3181f52d817e831150c94d>:
    
    > What we do in other such cases is not make it conditional on the
    > pointer argument being non-null, but rather make it conditional on the
    > length argument not being zero.  That way, it only catches the
    > "harmless" case of an "irrelevant" null pointer in combination with a
    > zero length, and doesn't hide bugs where the pointer is erroneously null
    > while the length is non-zero.
    
    So check for the length and not for the pointer argument.
    
    Change-Id: I1894eb67d49a9ae40cdce29de865172400a271dd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143134
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/external/freetype/ubsan.patch b/external/freetype/ubsan.patch
index 62d31f5d3be9..b27bbba09cb8 100644
--- a/external/freetype/ubsan.patch
+++ b/external/freetype/ubsan.patch
@@ -16,7 +16,7 @@
      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)
++    if (length != 0)
 +      FT_MEM_COPY( table->block + table->cursor, object, length );
  
      table->cursor += length;

Reply via email to