exteral/freetype: improve -fsanitize=non-null-attribute fix
commit5c85fc8552e8ce811833351b68b3d70b9bb6bf4f
authorMiklos Vajna <vmiklos@collabora.com>
Wed, 23 Nov 2022 07:13:44 +0000 (23 08:13 +0100)
committerMiklos Vajna <vmiklos@collabora.com>
Wed, 23 Nov 2022 08:06:33 +0000 (23 09:06 +0100)
treedb8c369d2734eabc7035df1aca8ef05837bd0cf8
parent7255d21f812b7333c83b4548e2b5b102adb606a9
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>
external/freetype/ubsan.patch