`A5-0-1`: False positive related to overeager alias analysis
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với thư viện SideEffects và phân tích A5-0-1 bị ảnh hưởng, sau đó kiểm tra các tham chiếu đến localFlow và AliasParameter. So sánh các ví dụ được cung cấp với cách xử lý side-effect của biểu thức và side-effect của lệnh gọi hàm, bao gồm trường hợp RULE-13-2. Công việc được hoàn thành khi phân tích alias không còn báo cáo các side-effect không được tuần tự hóa giả nữa, đồng thời vẫn phát hiện các hiệu ứng thực sự thông qua các tham số hàm.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Affected rules
A5-0-1- Likely others such as
RULE-13-2under more atypical conditions
Description
We can produce false positives related to unsequenced side effects from overeager alias analysis.
The SideEffects library attempts to capture side effects across function boundaries:
void f(int *i) {
(*i)++; // side-effect (*i)++
}
void g() {
int i;
f(&i); // side-effect: (*i)++
}
Detecting the latter case requires flow analysis. Currently, we perform flow analysis on all address-of operators, not just to parameters or through "other" functions. This leads to weird behavior:
void h() {
int i;
int j = &i;
i = 1;
j; // according to our analysis, this has a side-effect: i = 1
j + j; // reported as unsequenced side-effects
}
Our side effect analysis should be split into two distinct phases: side-effects within expressions, and side-effects from function calls.
It looks like we mostly do this, but incorrectly.
Side-effects within expressions
Should only use flow analysis to find aliases for cases such as:
void f() {
int i = 0;
int j = &i;
int x = i-- + (*j++); // unsequenced effects due to aliasing
}
That is, we can detect that *j is an alias of i and effectively consider the side-effects of i-- + i++. This is different than declaring *j has side-effects.
This is not currently handled correctly, as we inaccurately assign side-effects via localFlow.
Side-effects from function calls
void f(int *x) {
(*x)++;
}
We should recursively find parameters that become the subjects of side-effects. We should trace parameter x to the effect on x. Now f(x) can be discovered in the above phase as an effect on x -- without flow analysis.
We implement this as AliasParameter, but we don't find local flow from a parameter to its effect, we just look for effects on param.getAnAccess()
Example
Real code example in pandas
while (*step) {
stbtt__active_edge * z = *step;
if (z->ey <= scan_y_top) {
*step = z->next; // delete from list
STBTT_assert(z->direction);
z->direction = 0;
stbtt__hheap_free(&hh, z);
} else {
step = &((*step)->next); // advance through list
}
}
- Ngôn ngữ chính
- CodeQL
- Star
- 227
- Fork
- 82
- Merge trung bình
- 6 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 9
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/codeql-coding-standards
-
false positive/false negative Stardard-MISRA-C++
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/codeql-coding-standards#1172 ·
-
Difficulty-Low false positive/false negative false-negative Impact-Low Standard-MISRA-C
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Difficulty-Medium false positive/false negative false-positive Impact-Medium Standard-CERT-C
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
github/codeql-coding-standards#1200 ·
-
`RULE-0-0-1`: "unreachable statement" false positives due to over-pruning of the control-flow graph Đang mởfalse positive/false negative
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
github/codeql-coding-standards#1190 ·
-
false positive/false negative
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
github/codeql-coding-standards#1175 ·
Tất cả issue của github/codeql-coding-standards
Issue tương tự
-
wireguard-wp unbalanced "-RunAs" Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ScoopInstaller/Nonportable#639 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ScoopInstaller/Extras#18800 ·
-
Actualizar al último Wollok Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
uqbar-project/website-wollok-ts#84 · 2 bình luận ·
-
on hold T: core-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100