Missing validation in JSON constructors, LEFT expressions, and CH-block decoding
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
調査の方向性
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時間
- マージ済み PR(30日)
- 100
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 日以内に返信
pingcap/tiflash の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
useless statementオープン
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
grizzlypeak3d/DJV#962 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信