summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>2022-12-03 16:26:47 -0800
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2022-12-10 23:15:47 -0800
commit496d9bfeedda89a2211ec665f9214c2693c022f4 (patch)
tree41e8d34aff411d5429b3d87a4807db8a6eae15ae
parent7f7bcd7b6f569e9f70e3ddd134924f178e2596b1 (diff)
downloadxorg-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.c2
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];