Soundness: try/catch is checked as if the catch block always runs
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đá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
- 50/100
Hướng nghiên cứu
Locate where the verifier visits try/catch statements (search the visitor/checker for the try-statement case) and compare it with how if/else merges branch states at the join point — the issue says try/catch is currently sequenced instead of merged. Work out how both branches (normal exit from try, entry into catch at an arbitrary point) should be joined, and how the state after the join relates to the state on entry. Done means both reproducers in the issue report errors, the swapped-value case reports correctly, and existing verification tests still pass; add the reproducers as regression tests.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Impact: a real bug passes verification (false negative).
Description
The verifier checks try and catch blocks one after the other, so after a try/catch a variable keeps whatever the catch block last assigned. The path where the try finishes normally is lost. An if/else instead merges both branches after the join, and try/catch should be merged the same way.
Also, an exception can be thrown at any point in the try. The catch block should therefore not assume the try ran to completion, or that it never ran at all.
Minimal reproducer
import liquidjava.specification.ExternalRefinementsFor;
import liquidjava.specification.StateRefinement;
import liquidjava.specification.StateSet;
@ExternalRefinementsFor("java.lang.Throwable")
@StateSet({"withThrowable", "noThrowable"})
interface ThrowableRefinements {
@StateRefinement(to = "noThrowable(this)")
void Throwable(String message);
@StateRefinement(to = "withThrowable(this)")
void Throwable(String message, Throwable cause);
@StateRefinement(from = "noThrowable(this)", to = "withThrowable(this)")
Throwable initCause(Throwable cause);
}
public class Repro {
static void load() throws Exception { throw new Exception("x"); }
static void m() {
Throwable t = new Throwable("start");
try {
load();
t = new Throwable("try", new RuntimeException()); // withThrowable
} catch (Exception e) {
t = new Throwable("catch"); // noThrowable
}
t.initCause(new RuntimeException()); // not reported, but t is withThrowable if load() returns
}
}
Expected: a State Refinement Error on t.initCause(...), because t may be withThrowable.
Actual: Correct! Passed Verification.
Same bug with value refinements
static void m() {
int y = 0;
try {
load();
y = -5;
} catch (Exception e) {
y = 7;
}
@Refinement("_ > 0")
int z = y; // not reported, but y == -5 if load() returns
}
Actual: Correct! Passed Verification. If the values are swapped (5 in the try, -5 in the catch), the error is reported, but as z == -5 is not a subtype of z > 0: only the catch path is considered.
Found while reviewing #362 (catch parameters, #333).
- Ngôn ngữ chính
- Java
- Star
- 67
- Fork
- 36
- Merge trung bình
- 2 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 29
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc 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 liquid-java/liquidjava
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
liquid-java/liquidjava#373 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
liquid-java/liquidjava#321 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Synthesize hints for resolutionĐang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
liquid-java/liquidjava#381 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement future latte
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
liquid-java/liquidjava#380 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
An external spec cannot refine methods its class inheritsCó thể đã có người làm @CatarinaGamboa đã nhận 1 ngày trước. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
liquid-java/liquidjava#379 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của liquid-java/liquidjava
Issue tương tự
-
[Bug] The producer summary counts an unreported client version as a second version and warns about a version mixCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
apache/rocketmq-dashboard#6110 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
`Processing lsp` never exits and leaves orphaned processesCó thể đã có người làm @overcast302 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
processing/processing4#1578 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/doris-flink-connector#707 ·
-
ASM is not up-to-dateĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] S3 CORS responses omit Access-Control-Allow-Credentials for matched originsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
floci-io/floci#5369 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày