Missing validation in JSON constructors, LEFT expressions, and CH-block decoding
维护者通常 1 天内回复
评估
调研方向
The report identifies three areas: JSON constructors, buildLeftUTF8Function, and CH-block decoding, including cached appends; it does not name source files or tests. Start by tracing those entry points and their existing error handling, then inspect related tests for JSON, LEFT expressions, and V0/V1/V2 decoding. Done means rejecting the described invalid inputs with the specified errors while preserving the valid cases; pull request #11329 is already open.
由索引模型根据 Issue 内容生成。
描述
Bug Report
1. Minimal reproduce step (Required)
These are source-level reproduction scenarios; they were not executed locally.
- Pass a non-NULL, zero-byte binary JSON value to the internal
json_arrayfunction, or as a value argument tojson_object. These functions expect binary JSON, so this input represents an invalid binary JSON payload, not a valid JSON empty string. Both nullable and non-nullable execution branches constructJsonBinaryusingdata_from.size - 1without first checking that the input is nonempty. - Build a scalar DAG expression with signature
tipb::ScalarFuncSig::LeftUTF8and zero children, or one valid string child, then analyze it withDAGExpressionAnalyzer::getActions.buildLeftUTF8Functionreads children 0 and 1 without first checking their count. With more than two children, extra arguments are silently ignored. - Decode a CH-block chunk declaring two rows and two UInt64 columns, but containing two values in the first column and only one value, or no values, in the last column. For V1/V2, keep the declared sub-block row count at two and compress the shortened raw payload so compression framing remains valid. Exercise both first-chunk decoding and appending after a valid cached chunk. A single-column chunk that provides fewer values than its declared row count exposes the same missing validation.
2. What did you expect to see? (Required)
Reject non-NULL empty binary JSON with BAD_ARGUMENTS, before reading its type byte or subtracting from its length. SQL NULL values should still become JSON null, correctly encoded JSON empty strings should remain valid, and json_object should continue to accept empty member names.
Reject LEFT expressions whose child count is not exactly two with an ordinary Coprocessor::BadRequest error before accessing any child. Preserve normal two-argument UTF-8 LEFT behavior.
Reject CH-block columns whose decoded row count does not match the declared count with an ordinary CANNOT_READ_ALL_DATA error before exposing the Block to downstream execution. Check each column and sub-block, accounting for rows accumulated from previous chunks. Preserve valid V0/V1/V2 decoding, compression, and cached appends.
3. What did you see instead (Required)
For empty binary JSON constructor values, the length subtraction wraps to SIZE_MAX. JsonBinary stores that length without validation; the array/object builders can pass it through VectorWriter::write to memcpy, potentially crashing TiFlash.
For LEFT expressions with fewer than two children, the analyzer indexes outside the protobuf repeated field, potentially crashing TiFlash. Extra children are ignored instead of being rejected.
For truncated CH-block columns, numeric bulk deserialization accepts short reads at EOF. The V0 and V1/V2 decode paths do not verify each column's actual resulting size, and Block::rows() only reports the first column's size. A Block whose first column has two rows and last column has one can therefore reach downstream vectorized code that assumes equal column lengths, potentially reading outside the shorter column's valid range. The same gap exists during cached appends.
These findings were confirmed by source inspection, without a local runtime reproduction.
4. What is your TiFlash version? (Required)
master at 1e98c8ec6627674d848132a8f81b79baec80a7ad.
- 主要语言
- C++
- 星标
- 1k
- 派生
- 428
- 平均合并
- 2 天 7 小时
- 30 天内合并 PR
- 100
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pingcap/tiflash 的其他 Issue
-
component/compute type/bug
难度 2/5 1-2 天 新手友好度 82/100
维护者通常 1 天内回复
-
Out-of-bounds read in MyDateTime formatting from unvalidated packed values可能已有人在做 @ChangRui-Ryan 今天认领。 未关闭affects-25.10 affects-26.3 affects-26.9 affects-7.5 affects-8.1 affects-8.5 severity/major type/bug
难度 4/5 3-5 天 新手友好度 30/100
维护者通常 1 天内回复
-
component/storage severity/moderate type/bug
难度 4/5 3-5 天 新手友好度 48/100
pingcap/tiflash#11335 · 5 条评论 ·
维护者通常 1 天内回复
-
[disagg] Query fails with Code: 11000 NoSuchKey when S3 GC (ScanThenDelete) removes a DMFile that a compute node still reads可能已有人在做 @JinheLin 于 6 天前认领。 未关闭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 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Support binding a TiFlash node to a specific keyspace可能已有人在做 @ChangRui-Ryan 于 7 天前认领。 未关闭type/enhancement
难度 4/5 3-5 天 新手友好度 42/100
维护者通常 1 天内回复
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 86/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
grizzlypeak3d/DJV#962 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
cognizant-backlog
难度 2/5 1-3 小时 新手友好度 61/100
KhronosGroup/OpenCL-CTS#2882 · 1 条评论 ·
维护者通常 1 天内回复
-
Documentation: Fix parameter markup, legacy branch link, and phrasing in Detachable Joints and Model Command tutorials可能已有人在做 @patelshivani2283-lab 今天认领。 未关闭
难度 1/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复