Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FN and FP for ES_COMPARING_STRINGS_WITH_EQ with special character #65

Closed
Xiaoven opened this issue Dec 26, 2020 · 0 comments · Fixed by #94
Closed

FN and FP for ES_COMPARING_STRINGS_WITH_EQ with special character #65

Xiaoven opened this issue Dec 26, 2020 · 0 comments · Fixed by #94
Labels
false-negative False negative false-positive False positive

Comments

@Xiaoven
Copy link
Owner

Xiaoven commented Dec 26, 2020

False Negative

com/alibaba/fastjson/parser/deserializer/FieldDeserializer.java

if (collection == Collections.emptySet()
                                    || collection == Collections.emptyList()
                                    || collectionClassName == "java.util.ImmutableCollections$ListN"
                                    || collectionClassName == "java.util.ImmutableCollections$List12"
                                    || collectionClassName.startsWith("java.util.Collections$Unmodifiable")) {
                                // skip
                                return;
                            }

原因

现在的pattern为

r'((?:(?P<aux1>\((?:[^()]++|(?&aux1))*\))|[\w."])++)\s*[!=]=\s*((?:(?&aux1)|[\w."])+)'

其中 [\w."] 部分不能匹配 $ 符号(java 命名规则允许使用字符中比较少用的字符)

False Positive

nanohttpd/websocket/src/test/java/org/nanohttpd/junit/protocols/websockets/WebSocketResponseHandlerTest.java

this.headers.put("sec-websocket-key", "x3JJHMbDL1EzLkh9GBhXDw==");

原因

等号两边匹配结果 "x3JJHMbDL1EzLkh9GBhXDw".

is_str_with_quotes 方法现在只判断字符串开头和结尾字符是否为 ", 没有判断字符串长度,导致只包含" 的字符串蒙混过关。

Wrong line number for switch-case

switch (c) {
        case 'a':
        case 'A':
            if (csName == "ASCII" || equalEncodings(csName, "ASCII")) {
                return CS_US_ASCII;
            }
            break;

        case 'c':
@Xiaoven Xiaoven added the false-negative False negative label Dec 26, 2020
@Xiaoven Xiaoven changed the title False Negative for ES_COMPARING_STRINGS_WITH_EQ with special character FN and FP for ES_COMPARING_STRINGS_WITH_EQ with special character Dec 26, 2020
@Xiaoven Xiaoven added the false-positive False positive label Dec 26, 2020
@Xiaoven Xiaoven linked a pull request Jan 16, 2021 that will close this issue
@Xiaoven Xiaoven closed this as completed Jan 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false-negative False negative false-positive False positive
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant