[Bug] PackedFileReader reads past a slice into the neighbouring file when the offset is beyond the slice size
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
調査の方向性
issueで引用されている be/src/io/fs/packed_file_reader.cpp の read_at_impl にある計算から始めます。既存のPackedFileReaderのユニットテストを見つけ、スライスサイズを超えるオフセットのテストを追加します。パックされたファイル内の隣接スライスも含めてください。範囲外の読み取りがスライスとオフセットの詳細を含む Status::Corruption を返し、有効な読み取りが引き続き動作すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Search before asking
- I had searched in the issues and found no similar issues.
Version
4.1.4 (cloud mode, packed files). master is the same: be/src/io/fs/packed_file_reader.cpp:54:
size_t max_read = std::min(result.get_size(), static_cast<size_t>(_file_size - offset));
Description
PackedFileReader::read_at_impl reads a slice of a packed file. _file_size is int64_t and offset is size_t, so _file_size - offset is computed in unsigned arithmetic. When offset is past the end of the slice, it wraps to a huge value, max_read becomes the full request size, and the read returns the bytes that follow the slice in the packed file. Those belong to another file, so the caller gets silently wrong data instead of an error (for example, a corrupt-looking index or segment page that is actually a neighbour's bytes).
Solution
Check the offset before computing the length and return Status::Corruption (naming the slice, its size and offset in the packed file) when offset > _file_size (or _file_size < 0); compute the remaining length as static_cast<size_t>(_file_size) - offset.
How to Reproduce?
Unit test: open a PackedFileReader over a slice of size N inside a larger packed file and call read_at(N + k, ...); it returns bytes from the next slice instead of failing.
Anything Else?
An out-of-range offset normally means wrong metadata somewhere upstream of the reader, which is exactly when an error is more useful than another file's bytes.
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
- 主要言語
- Java
- スター
- 16.1k
- フォーク
- 4k
- 平均マージ
- 1日 16時間
- マージ済み PR(30日)
- 685
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/doris のほかの issue
-
[Bug] Upper-case hex in cloud initial rowset id is mis-parsed by BE from_hex (lossy, non-unique RowsetId)対応中かも @siddiqueirshad が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/doris#69371 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[Doc] 官方文档中 S3 路径风格访问参数错误 (s3.use_path_style)対応中かも @wy471x が 6 日前に担当しました。 オープン
難易度 2/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
4.1.4.1 Release Noteオープンrelease notes
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
[Bug] FE metric http_copy_into_query_err_total is registered under the upload error name対応中かも @manesioz が 35 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
apache/doris#68505 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
area:core bug priority:p2
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
aomarai/minecraft-mcp#247 ·
メンテナーはふだん 1 日以内に返信
-
help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
antonyrag/ragleap-core#1062 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
Vakore/ZappierGames#232 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
constellation-app/constellation#2588 ·