diff options
author | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2022-12-03 16:26:47 -0800 |
---|---|---|
committer | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2022-12-10 23:15:47 -0800 |
commit | 496d9bfeedda89a2211ec665f9214c2693c022f4 (patch) | |
tree | 41e8d34aff411d5429b3d87a4807db8a6eae15ae | |
parent | 7f7bcd7b6f569e9f70e3ddd134924f178e2596b1 (diff) | |
download | xorg-lib-libX11-496d9bfeedda89a2211ec665f9214c2693c022f4.tar.gz |
ximcp: Address warning found by UBSan when growing an empty tree
imLcPrs.c:681:52: runtime error: applying zero offset to null pointer
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-rw-r--r-- | modules/im/ximcp/imLcPrs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/im/ximcp/imLcPrs.c b/modules/im/ximcp/imLcPrs.c index 795ea719..ea6d429a 100644 --- a/modules/im/ximcp/imLcPrs.c +++ b/modules/im/ximcp/imLcPrs.c @@ -678,7 +678,7 @@ parseline( b->treesize = newsize; /* Re-derive top after realloc() to avoid undefined behaviour (and crashes on architectures that track pointer bounds). */ - if (top >= (DTIndex *) old && top < (DTIndex *) &old[oldsize]) + if (old && top >= (DTIndex *) old && top < (DTIndex *) &old[oldsize]) top = (DTIndex *) (((char *)new) + (((char *)top)-(char *)old)); } p = &b->tree[b->treeused]; |