GeezerVison is showing github.com — fix all ql/use-string-compare · github/codeql@86e97c3
File treeExpand file treeCollapse file tree Open diff view settings lib/semmle/code/cpp/commons experimental/Security/CWE/CWE-266
csharp/ql/src/Likely Bugs/LeapYear experimental/Security/CWE utils/model-generator/internal
experimental/semmle/python/libraries
ruby/ql/lib/codeql/ruby/security/internal
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: cpp/ql/lib/semmle/code/cpp/commons/Printf.qll +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -872,7 +872,7 @@ class FormatLiteral extends Literal { | 872 | 872 |
| 873 | 873 | private Type getConversionType1(int n) { | 874 | 874 | exists(string cnv | cnv = this.getConversionChar(n) | | 875 | | - cnv.regexpMatch("d|i") and | | 875 | + cnv = ["d", "i"] and | 876 | 876 | result = this.getIntegralConversion(n) and | 877 | 877 | not result.getUnderlyingType().(IntegralType).isExplicitlySigned() and | 878 | 878 | not result.getUnderlyingType().(IntegralType).isExplicitlyUnsigned() | @@ -912,15 +912,15 @@ class FormatLiteral extends Literal { | 912 | 912 |
| 913 | 913 | private Type getConversionType2(int n) { | 914 | 914 | exists(string cnv | cnv = this.getConversionChar(n) | | 915 | | - cnv.regexpMatch("o|u|x|X") and | | 915 | + cnv = ["o", "u", "x", "X"] and | 916 | 916 | result = this.getIntegralConversion(n) and | 917 | 917 | result.getUnderlyingType().(IntegralType).isUnsigned() | 918 | 918 | ) | 919 | 919 | } | 920 | 920 |
| 921 | 921 | private Type getConversionType3(int n) { | 922 | 922 | exists(string cnv | cnv = this.getConversionChar(n) | | 923 | | - cnv.regexpMatch("a|A|e|E|f|F|g|G") and result = this.getFloatingPointConversion(n) | | 923 | + cnv = ["a", "A", "e", "E", "f", "F", "g", "G"] and result = this.getFloatingPointConversion(n) | 924 | 924 | ) | 925 | 925 | } | 926 | 926 |
| |
Collapse file Copy file name to clipboardExpand all lines: cpp/ql/src/experimental/Security/CWE/CWE-266/IncorrectPrivilegeAssignment.ql +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 58 | 58 | // unfortunately cannot use numeric value here because // O_CREAT is defined differently on different OSes: | 59 | 59 | // https://github.com/red/red/blob/92feb0c0d5f91e087ab35fface6906afbf99b603/runtime/definitions.reds#L477-L491 | 60 | 60 | // this may introduce false negatives | 61 | | - fctmp.getArgument(1).(BitwiseOrExpr).getAChild*().getValueText().matches("O\\_CREAT") or | | 61 | + fctmp.getArgument(1).(BitwiseOrExpr).getAChild*().getValueText() = "O_CREAT" or | 62 | 62 | fctmp.getArgument(1).getValueText().matches("%O_CREAT%") | 63 | 63 | ) and | 64 | 64 | fctmp.getNumberOfArguments() = 2 and | |
Collapse file Copy file name to clipboardExpand all lines: cpp/ql/src/jsf/4.05 Libraries/AV Rule 23.ql +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,7 @@ import cpp | 13 | 13 |
| 14 | 14 | from Function f | 15 | 15 | where | 16 | | - f.getName().regexpMatch("atof|atoi|atol") and | | 16 | + f.getName() = ["atof", "atoi", "atol"] and | 17 | 17 | f.getFile().getAbsolutePath().matches("%stdlib.h") | 18 | 18 | select f.getACallToThisFunction(), | 19 | 19 | "AV Rule 23: The library functions atof, atoi and atol from library <stdlib.h> shall not be used." |
Collapse file Copy file name to clipboardExpand all lines: cpp/ql/src/jsf/4.05 Libraries/AV Rule 24.ql +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,7 @@ import cpp | 13 | 13 |
| 14 | 14 | from Function f | 15 | 15 | where | 16 | | - f.getName().regexpMatch("abort|exit|getenv|system") and | | 16 | + f.getName() = ["abort", "exit", "getenv", "system"] and | 17 | 17 | f.getFile().getAbsolutePath().matches("%stdlib.h") | 18 | 18 | select f.getACallToThisFunction(), | 19 | 19 | "The library functions abort, exit, getenv and system from library <stdlib.h> should not be used." |
Collapse file Copy file name to clipboardExpand all lines: csharp/ql/src/Likely Bugs/LeapYear/UnsafeYearConstruction.ql +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -20,7 +20,7 @@ class UnsafeYearCreationFromArithmeticConfiguration extends TaintTracking::Confi | 20 | 20 | override predicate isSource(DataFlow::Node source) { | 21 | 21 | exists(ArithmeticOperation ao, PropertyAccess pa | ao = source.asExpr() | | 22 | 22 | pa = ao.getAChild*() and | 23 | | - pa.getProperty().getQualifiedName().matches("System.DateTime.Year") | | 23 | + pa.getProperty().hasQualifiedName("System.DateTime.Year") | 24 | 24 | ) | 25 | 25 | } | 26 | 26 |
| |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/Collections.qll +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -92,7 +92,7 @@ class CollectionMutation extends MethodAccess { | 92 | 92 | /** A method that queries the contents of a collection without mutating it. */ | 93 | 93 | class CollectionQueryMethod extends CollectionMethod { | 94 | 94 | CollectionQueryMethod() { | 95 | | - pragma[only_bind_into](this).getName().regexpMatch("contains|containsAll|get|size|peek") | | 95 | + pragma[only_bind_into](this).getName() = ["contains", "containsAll", "get", "size", "peek"] | 96 | 96 | } | 97 | 97 | } | 98 | 98 |
| |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/JDK.qll +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -148,10 +148,9 @@ class NumberType extends RefType { | 148 | 148 | class NumericType extends Type { | 149 | 149 | NumericType() { | 150 | 150 | exists(string name | | 151 | | - name = this.(PrimitiveType).getName() or | 152 | | - name = this.(BoxedType).getPrimitiveType().getName() | | 151 | + name = [this.(PrimitiveType).getName(), this.(BoxedType).getPrimitiveType().getName()] | 153 | 152 | | | 154 | | - name.regexpMatch("byte|short|int|long|double|float") | | 153 | + name = ["byte", "short", "int", "long", "double", "float"] | 155 | 154 | ) | 156 | 155 | } | 157 | 156 | } | |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/Maps.qll +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -59,9 +59,8 @@ class MapMutation extends MethodAccess { | 59 | 59 | /** A method that queries the contents of the map it belongs to without mutating it. */ | 60 | 60 | class MapQueryMethod extends MapMethod { | 61 | 61 | MapQueryMethod() { | 62 | | - pragma[only_bind_into](this) | 63 | | - .getName() | 64 | | - .regexpMatch("get|containsKey|containsValue|entrySet|keySet|values|isEmpty|size") | | 62 | + pragma[only_bind_into](this).getName() = | | 63 | + ["get", "containsKey", "containsValue", "entrySet", "keySet", "values", "isEmpty", "size"] | 65 | 64 | } | 66 | 65 | } | 67 | 66 |
| |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/Type.qll +11-9Lines changed: 11 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1002,7 +1002,9 @@ class FunctionalInterface extends Interface { | 1002 | 1002 | * and `double`. | 1003 | 1003 | */ | 1004 | 1004 | class PrimitiveType extends Type, @primitive { | 1005 | | - PrimitiveType() { this.getName().regexpMatch("float|double|int|boolean|short|byte|char|long") } | | 1005 | + PrimitiveType() { | | 1006 | + this.getName() = ["float", "double", "int", "boolean", "short", "byte", "char", "long"] | | 1007 | + } | 1006 | 1008 |
| 1007 | 1009 | /** Gets the boxed type corresponding to this primitive type. */ | 1008 | 1010 | BoxedType getBoxedType() { result.getPrimitiveType() = this } | @@ -1217,9 +1219,9 @@ predicate erasedHaveIntersection(RefType t1, RefType t2) { | 1217 | 1219 | class IntegralType extends Type { | 1218 | 1220 | IntegralType() { | 1219 | 1221 | exists(string name | | 1220 | | - name = this.(PrimitiveType).getName() or name = this.(BoxedType).getPrimitiveType().getName() | | 1222 | + name = [this.(PrimitiveType).getName(), this.(BoxedType).getPrimitiveType().getName()] | 1221 | 1223 | | | 1222 | | - name.regexpMatch("byte|char|short|int|long") | | 1224 | + name = ["byte", "char", "short", "int", "long"] | 1223 | 1225 | ) | 1224 | 1226 | } | 1225 | 1227 | } | @@ -1228,7 +1230,7 @@ class IntegralType extends Type { | 1228 | 1230 | class BooleanType extends Type { | 1229 | 1231 | BooleanType() { | 1230 | 1232 | exists(string name | | 1231 | | - name = this.(PrimitiveType).getName() or name = this.(BoxedType).getPrimitiveType().getName() | | 1233 | + name = [this.(PrimitiveType).getName(), this.(BoxedType).getPrimitiveType().getName()] | 1232 | 1234 | | | 1233 | 1235 | name = "boolean" | 1234 | 1236 | ) | @@ -1239,7 +1241,7 @@ class BooleanType extends Type { | 1239 | 1241 | class CharacterType extends Type { | 1240 | 1242 | CharacterType() { | 1241 | 1243 | exists(string name | | 1242 | | - name = this.(PrimitiveType).getName() or name = this.(BoxedType).getPrimitiveType().getName() | | 1244 | + name = [this.(PrimitiveType).getName(), this.(BoxedType).getPrimitiveType().getName()] | 1243 | 1245 | | | 1244 | 1246 | name = "char" | 1245 | 1247 | ) | @@ -1250,9 +1252,9 @@ class CharacterType extends Type { | 1250 | 1252 | class NumericOrCharType extends Type { | 1251 | 1253 | NumericOrCharType() { | 1252 | 1254 | exists(string name | | 1253 | | - name = this.(PrimitiveType).getName() or name = this.(BoxedType).getPrimitiveType().getName() | | 1255 | + name = [this.(PrimitiveType).getName(), this.(BoxedType).getPrimitiveType().getName()] | 1254 | 1256 | | | 1255 | | - name.regexpMatch("byte|char|short|int|long|double|float") | | 1257 | + name = ["byte", "char", "short", "int", "long", "double", "float"] | 1256 | 1258 | ) | 1257 | 1259 | } | 1258 | 1260 | } | @@ -1261,9 +1263,9 @@ class NumericOrCharType extends Type { | 1261 | 1263 | class FloatingPointType extends Type { | 1262 | 1264 | FloatingPointType() { | 1263 | 1265 | exists(string name | | 1264 | | - name = this.(PrimitiveType).getName() or name = this.(BoxedType).getPrimitiveType().getName() | | 1266 | + name = [this.(PrimitiveType).getName(), this.(BoxedType).getPrimitiveType().getName()] | 1265 | 1267 | | | 1266 | | - name.regexpMatch("float|double") | | 1268 | + name = ["float", "double"] | 1267 | 1269 | ) | 1268 | 1270 | } | 1269 | 1271 | } |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/dataflow/RangeAnalysis.qll +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -337,15 +337,15 @@ private predicate safeCast(Type fromtyp, Type totyp) { | 337 | 337 | exists(PrimitiveType pfrom, PrimitiveType pto | pfrom = fromtyp and pto = totyp | | 338 | 338 | pfrom = pto | 339 | 339 | or | 340 | | - pfrom.hasName("char") and pto.getName().regexpMatch("int|long|float|double") | | 340 | + pfrom.hasName("char") and pto.hasName(["int", "long", "float", "double"]) | 341 | 341 | or | 342 | | - pfrom.hasName("byte") and pto.getName().regexpMatch("short|int|long|float|double") | | 342 | + pfrom.hasName("byte") and pto.hasName(["short", "int", "long", "float", "double"]) | 343 | 343 | or | 344 | | - pfrom.hasName("short") and pto.getName().regexpMatch("int|long|float|double") | | 344 | + pfrom.hasName("short") and pto.hasName(["int", "long", "float", "double"]) | 345 | 345 | or | 346 | | - pfrom.hasName("int") and pto.getName().regexpMatch("long|float|double") | | 346 | + pfrom.hasName("int") and pto.hasName(["long", "float", "double"]) | 347 | 347 | or | 348 | | - pfrom.hasName("long") and pto.getName().regexpMatch("float|double") | | 348 | + pfrom.hasName("long") and pto.hasName(["float", "double"]) | 349 | 349 | or | 350 | 350 | pfrom.hasName("float") and pto.hasName("double") | 351 | 351 | or | |
|