mirror of
https://github.com/github/codeql.git
synced 2026-01-29 14:23:03 +01:00
Merge pull request #240 from sauyon/rune-literal-string-value
Make rune literal string value its value
This commit is contained in:
@@ -18,8 +18,6 @@ StringOps::HasPrefix checkForLeadingSlash(SsaWithFields v) {
|
||||
result.getBaseString() = v.getAUse() and result.getSubstring() = substr
|
||||
|
|
||||
substr.getStringValue() = "/"
|
||||
or
|
||||
substr.getIntValue() = 47 // ASCII value for '/'
|
||||
)
|
||||
}
|
||||
|
||||
@@ -31,7 +29,7 @@ DataFlow::Node checkForSecondSlash(SsaWithFields v) {
|
||||
exists(DataFlow::EqualityTestNode eq, DataFlow::Node slash, DataFlow::ElementReadNode er |
|
||||
result = eq
|
||||
|
|
||||
slash.getIntValue() = 47 and // ASCII value for '/'
|
||||
slash.getStringValue() = "/" and
|
||||
er.getBase() = v.getAUse() and
|
||||
er.getIndex().getIntValue() = 1 and
|
||||
eq.eq(_, er, slash)
|
||||
@@ -46,7 +44,7 @@ DataFlow::Node checkForSecondBackslash(SsaWithFields v) {
|
||||
exists(DataFlow::EqualityTestNode eq, DataFlow::Node slash, DataFlow::ElementReadNode er |
|
||||
result = eq
|
||||
|
|
||||
slash.getIntValue() = 92 and // ASCII value for '\'
|
||||
slash.getStringValue() = "\\" and
|
||||
er.getBase() = v.getAUse() and
|
||||
er.getIndex().getIntValue() = 1 and
|
||||
eq.eq(_, er, slash)
|
||||
|
||||
@@ -220,7 +220,11 @@ class ImagLit extends @imaglit, BasicLit { }
|
||||
/**
|
||||
* A character literal.
|
||||
*/
|
||||
class CharLit extends @charlit, BasicLit { }
|
||||
class CharLit extends @charlit, BasicLit {
|
||||
// use the constant value of the literal as the string value, as the value we get from the
|
||||
// compiler is an integer, meaning we would not otherwise have a string value for rune literals
|
||||
override string getStringValue() { result = this.getValue() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A string literal.
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
| consts.go:32:29:32:36 | ...-... | 2.3 - 9.7i | (2.3 + -9.7i), (2589569785738035/1125899906842624 + -2730307274093363/281474976710656i) |
|
||||
| consts.go:32:33:32:36 | 9.7i | 9.7i | (0 + 9.7i), (0 + 97/10i) |
|
||||
| consts.go:33:3:33:5 | 'a' | 'a' | 97, 97 |
|
||||
| consts.go:33:3:33:5 | 'a' | 'a' | a |
|
||||
| consts.go:33:8:33:13 | '\\x8b' | '\\x8b' | 139, 139 |
|
||||
| consts.go:33:8:33:13 | '\\x8b' | '\\x8b' | \ufffd |
|
||||
| consts.go:33:16:33:38 | 3.141592653589793238462 | 3.141592653589793238462 | 3.141593, 1570796326794896619231/500000000000000000000 |
|
||||
| consts.go:33:16:33:40 | ...*... | 3.141592653589793238462 * 8 | 25.132741, 884279719003555/35184372088832 |
|
||||
| consts.go:33:40:33:40 | 8 | 8 | 8, 8 |
|
||||
|
||||
Reference in New Issue
Block a user