Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Bug] PackedFileReader reads past a slice into the neighbouring file when the offset is beyond the slice size

オープン 初心者向け
#69,863 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp
領域
backend, databases

調査の方向性

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
主要言語
Java
スター
16.1k
フォーク
4k
平均マージ
1日 16時間
マージ済み PR(30日)
685

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/doris のほかの issue

apache/doris の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。