Out-of-bounds read in MyDateTime formatting from unvalidated packed values
Maintainer thường phản hồi trong vòng 1 ngà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
- 30/100
Hướng nghiên cứu
Start with decodeLiteral in dbms/src/Flash/Coprocessor/DAGUtils.cpp and the packed-value constructor and formatters in dbms/src/Common/MyTime.cpp. Trace how malformed literals and boundary rounding or timezone shifts reach formatting, then inspect the linked pull request for ongoing work. Done means packed datetimes are range-checked before unsafe formatting paths and tests cover crafted out-of-range values and boundary cases.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug Report
1. Minimal reproduce step (Required)
tipb::ExprType::MysqlTime literals are decoded without any range check
(decodeLiteral in dbms/src/Flash/Coprocessor/DAGUtils.cpp), and
MyTimeBase::MyTimeBase(UInt64 packed) (dbms/src/Common/MyTime.cpp:322)
unpacks the raw 64-bit value without validating the format invariants.
The UInt64 field then passes through convertFieldToType unchanged into
DataTypeMyDateTime columns.
Send a hand-crafted coprocessor/MPP request to the TiFlash service port
containing a datetime literal whose 8-byte val encodes out-of-range
fields, e.g. micro_second = 16777215 (> 999999) or year = 20164
(> 9999), and let any formatting path consume it
(date_format(col, '%f'), cast(col as string), or result
serialization).
MyDateTime::toString/%fformatter indexes
int_to_2_width_string[micro_second / 10000]→ up to index 1677%Y/%X/%xformatters indexint_to_2_width_string[year / 100]
→ up to index 201
(int_to_2_width_string is a 100-entry static array.)
Under ASan any such request reports a global-buffer-overflow in
dbms/src/Common/MyTime.cpp. Legitimate TiDB instances never emit such
values (datetime literals are validated at parse time), so this requires
a directly crafted gRPC request.
Out-of-range packed values can also be produced internally at the max
datetime boundary (pre-existing issue, same sink): fraction-rounding
overflow on 9999-12-31 23:59:59.9999999 and timezone-shift of
9999-12-31 23:59:59-14:00 yield year=10000, i.e.
int_to_2_width_string[100], one-past-end.
2. What did you expect to see? (Required)
Out-of-range packed datetime values must be rejected at the request
boundary, and every packed value reaching MyDateTime must stay within
the documented field ranges (year <= 9999, micro_second <= 999999,
etc.). No memory-safety violation regardless of request bytes.
3. What did you see instead (Required)
Out-of-bounds reads up to ~1.6k entries past the end of the static
int_to_2_width_string array. The adjacent global memory is
interpreted as String objects and appended into the query result
returned to the client — information disclosure — or causes a crash on
invalid String objects. Classified High / INFORMATION_DISCLOSURE by
the internal code-security scan (first detected 2026-11-13).
4. What is your TiFlash version? (Required)
master
- Ngôn ngữ chính
- C++
- Star
- 1k
- Fork
- 428
- Merge trung bình
- 2 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 100
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không 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 pingcap/tiflash
-
component/compute type/bug
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
component/storage severity/moderate type/bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
pingcap/tiflash#11335 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Missing validation in JSON constructors, LEFT expressions, and CH-block decodingCó thể đã có người làm @windtalker đã nhận hôm nay. Đang mởtype/bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[disagg] Query fails with Code: 11000 NoSuchKey when S3 GC (ScanThenDelete) removes a DMFile that a compute node still readsCó thể đã có người làm @JinheLin đã nhận 6 ngày trước. Đang mởmay-affects-25.10 may-affects-26.3 may-affects-26.9 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/moderate type/bug
pingcap/tiflash#11291 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support binding a TiFlash node to a specific keyspaceCó thể đã có người làm @ChangRui-Ryan đã nhận 7 ngày trước. Đang mởtype/enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của pingcap/tiflash
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
useless statementĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
grizzlypeak3d/DJV#962 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày