`CON34-C`: Implementation seems to check incorrect aspects of thread storage duration objects
Một pull request liên quan đã được merge.
- #778 của @lcartey — đã merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với phần triển khai CON34-C và quá trình xác thực hiện có cho các giá trị tss_t, sau đó so sánh với các ví dụ tuân thủ và không tuân thủ trong issue này. Thay đổi được hoàn tất khi vi phạm thread-storage dự kiến được báo cáo và các trường hợp giá trị chưa được khởi tạo không liên quan không bị quy cho CON34-C; hãy xác thực bằng các bài kiểm thử hiện có cho rule.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Affected rules
CON34-C
Description
The documentation seems to describe the risk of passing a tss_t into a thread. The risk here is that the new thread will have no value.
In the "compliant" case it says the appropriate fix is to use tss_get() to get the value in the current thread, then pass that value into the new thread.
In our implementation, we check that any tss_t values are definitely given a value before retrieved and passed into a thread creation statement. This is not the intention of the rule, adds additional implementation complexity, and reveals no violations in MRVA.
Example
tss_t key;
void f1() {
// Should be marked non-compliant: new thread has no value for tss_get(key)
// Currently not reported
thrd_create(..., &key);
}
void f2() {
// While the following code is suspect, it is NOT the intention of the rule is not to disallow this:
tss_t localkey;
tss_set(localkey, malloc(...));
void* v = tss_get(localkey);
thrd_create(..., v);
// The fact that v is uninitialized has nothing to do with threads. For instance, this is also erroneous:
printf("%d", *v);
// Further, the above code has nothing to do with thread storage duration, and isn't necessarily invalid:
static void *shared_buf = malloc(...);
thrd_create(..., shared_buf); // Reasonable pattern
}
- 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