Browse code

core: safety checks for swich statements with no case branch

Daniel-Constantin Mierla authored on 14/05/2015 11:33:50
Showing 1 changed files
... ...
@@ -230,7 +230,9 @@ int fix_switch(struct action* t)
230 230
 				LM_DBG("default only switch optimized away (BLOCK_T)\n");
231 231
 				return 0;
232 232
 			}
233
-			LM_DBG("default only switch with side-effect...\n");
233
+			LM_CRIT("default only switch with side-effect not expected at this point\n");
234
+			ret=E_BUG;
235
+			goto error;
234 236
 		}else{
235 237
 			LM_CRIT("empty switch not expected at this point\n");
236 238
 			ret=E_BUG;
... ...
@@ -545,7 +547,9 @@ static int fix_match(struct action* t)
545 545
 				LM_DBG("default only switch optimized away (BLOCK_T)\n");
546 546
 				return 0;
547 547
 			}
548
-			LM_DBG("default only switch with side-effect...\n");
548
+			LM_CRIT("default only switch with side-effect not expected at this point\n");
549
+			ret=E_BUG;
550
+			goto error;
549 551
 		}else{
550 552
 			LM_CRIT("empty switch not expected at this point\n");
551 553
 			ret=E_BUG;