Fix dereference after NULL issue
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 13 Mar 2023 06:13:03 +0000 (15:13 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 21 Dec 2023 23:47:25 +0000 (08:47 +0900)
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 <jihoon48.kim@samsung.com>
src/xkbcomp/symbols.c

index 58f73e6..c79241e 100644 (file)
@@ -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;