浏览代码

core: safety checks for swich statements with no case branch

Daniel-Constantin Mierla 10 年之前
父节点
当前提交
af9deb9026
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      switch.c

+ 6 - 2
switch.c

@@ -230,7 +230,9 @@ int fix_switch(struct action* t)
 				LM_DBG("default only switch optimized away (BLOCK_T)\n");
 				LM_DBG("default only switch optimized away (BLOCK_T)\n");
 				return 0;
 				return 0;
 			}
 			}
-			LM_DBG("default only switch with side-effect...\n");
+			LM_CRIT("default only switch with side-effect not expected at this point\n");
+			ret=E_BUG;
+			goto error;
 		}else{
 		}else{
 			LM_CRIT("empty switch not expected at this point\n");
 			LM_CRIT("empty switch not expected at this point\n");
 			ret=E_BUG;
 			ret=E_BUG;
@@ -545,7 +547,9 @@ static int fix_match(struct action* t)
 				LM_DBG("default only switch optimized away (BLOCK_T)\n");
 				LM_DBG("default only switch optimized away (BLOCK_T)\n");
 				return 0;
 				return 0;
 			}
 			}
-			LM_DBG("default only switch with side-effect...\n");
+			LM_CRIT("default only switch with side-effect not expected at this point\n");
+			ret=E_BUG;
+			goto error;
 		}else{
 		}else{
 			LM_CRIT("empty switch not expected at this point\n");
 			LM_CRIT("empty switch not expected at this point\n");
 			ret=E_BUG;
 			ret=E_BUG;