|
|
@ -68,17 +68,17 @@ public class DLLVerifyChecker extends SquidCheck<Grammar> { |
|
|
|
//判断是否式动态加载库
|
|
|
|
//判断是否式动态加载库
|
|
|
|
if("dlopen".equals(desc.getTokenValue())){ |
|
|
|
if("dlopen".equals(desc.getTokenValue())){ |
|
|
|
//获取其中的参数列表
|
|
|
|
//获取其中的参数列表
|
|
|
|
AstNode firstDescendant = desc.getFirstDescendant(CxxGrammarImpl.additiveExpression); |
|
|
|
AstNode firstDescendant = desc.getFirstDescendant(CxxGrammarImpl.expressionList); |
|
|
|
if(firstDescendant != null){ |
|
|
|
if(firstDescendant != null){ |
|
|
|
List<AstNode> children = firstDescendant.getChildren(); |
|
|
|
List<AstNode> children = firstDescendant.getChildren(); |
|
|
|
for(AstNode dren : children){ |
|
|
|
for(AstNode dren : children){ |
|
|
|
//获取参数并进行判断是否是传入的参数
|
|
|
|
//获取参数并进行判断是否是传入的参数
|
|
|
|
if("IDENTIFIER".equals(dren.getName())){ |
|
|
|
if("IDENTIFIER".equals(dren.getName()) || "initializerList".equals(dren.getName())){ |
|
|
|
if(map.containsKey(dren.getTokenValue())){ |
|
|
|
if(map.containsKey(dren.getTokenValue())){ |
|
|
|
//判断参数是否进行过校验
|
|
|
|
//判断参数是否进行过校验
|
|
|
|
Integer integer = map.get(dren.getTokenValue()); |
|
|
|
Integer integer = map.get(dren.getTokenValue()); |
|
|
|
//判断参数校验是否在使用之前
|
|
|
|
//判断参数校验是否在使用之前
|
|
|
|
if(dren.getTokenLine() > integer){ |
|
|
|
if(dren.getTokenLine() < integer){ |
|
|
|
getContext().createLineViolation(this,name,dren); |
|
|
|
getContext().createLineViolation(this,name,dren); |
|
|
|
} |
|
|
|
} |
|
|
|
}else { |
|
|
|
}else { |
|
|
@ -86,8 +86,6 @@ public class DLLVerifyChecker extends SquidCheck<Grammar> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}else { |
|
|
|
|
|
|
|
getContext().createLineViolation(this,name,desc); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -108,7 +106,7 @@ public class DLLVerifyChecker extends SquidCheck<Grammar> { |
|
|
|
if (map.containsKey(desc.getTokenValue())){ |
|
|
|
if (map.containsKey(desc.getTokenValue())){ |
|
|
|
//判断参数校验是否在使用之前
|
|
|
|
//判断参数校验是否在使用之前
|
|
|
|
int tokenLine = map.get(desc.getTokenValue()); |
|
|
|
int tokenLine = map.get(desc.getTokenValue()); |
|
|
|
if(desc.getTokenLine() > tokenLine){ |
|
|
|
if(desc.getTokenLine() < tokenLine){ |
|
|
|
getContext().createLineViolation(this,name,desc); |
|
|
|
getContext().createLineViolation(this,name,desc); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|