Files
loongoffice/external/freetype/ubsan.patch
Miklos Vajna 5c85fc8552 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 <vmiklos@collabora.com>
2022-11-23 09:06:33 +01:00

24 lines
1.0 KiB
Diff

--- src/truetype/ttgxvar.c
+++ src/truetype/ttgxvar.c
@@ -964,7 +964,7 @@
/* in the OpenType specification. */
varData = &itemStore->varData[outerIndex];
- deltaSet = &varData->deltaSet[varData->regionIdxCount * innerIndex];
+ deltaSet = varData->regionIdxCount * innerIndex == 0 ? varData->deltaSet : &varData->deltaSet[varData->regionIdxCount * innerIndex];
/* 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 (length != 0)
+ FT_MEM_COPY( table->block + table->cursor, object, length );
table->cursor += length;
return FT_Err_Ok;