From: Jihoon Kim Date: Mon, 13 Mar 2023 06:13:03 +0000 (+0900) Subject: Fix dereference after NULL issue X-Git-Tag: accepted/tizen/unified/20240109.155348~9 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Flibxkbcommon.git;a=commitdiff_plain;h=496c4ca641cbef4b54d4e68fbc9bc0ddc3619489 Fix dereference after NULL issue After having been compared to a NULL value at symbols.c 763, pointer 'act' is passed as 4th parameter in call to function 'HandleActionDef' at symbols.c 775, where it is dereferenced at action.c 788. Change-Id: Ib25edc48b26d523fa11a5e99d171750bd768b14d Signed-off-by: Jihoon Kim --- diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 58f73e6..c79241e 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -792,14 +792,15 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx, for (unsigned i = 0; i < nActs; i++) { union xkb_action *toAct = &darray_item(groupi->levels, i).action; - if (!HandleActionDef(info->ctx, info->actions, &info->mods, act, toAct)) - log_err(info->ctx, - XKB_ERROR_INVALID_VALUE, - "Illegal action definition for %s; " - "Action for group %u/level %u ignored\n", - KeyInfoText(info, keyi), ndx + 1, i + 1); + if (act) { + if (!HandleActionDef(info->ctx, info->actions, &info->mods, act, toAct)) + log_err(info->ctx, + "Illegal action definition for %s; " + "Action for group %u/level %u ignored\n", + KeyInfoText(info, keyi), ndx + 1, i + 1); - act = (ExprDef *) act->common.next; + act = (ExprDef *) act->common.next; + } } return true;