[Bug] PackedFileReader reads past a slice into the neighbouring file when the offset is beyond the slice size
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 issue 中引用的 be/src/io/fs/packed_file_reader.cpp 里的 read_at_impl 计算开始。找到现有的 PackedFileReader 单元测试,并添加对偏移量超出 slice 大小的覆盖,包括打包文件中的相邻 slice。完成标准是:越界读取返回包含 slice 和偏移量详情的 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 小时
- 30 天内合并 PR
- 685
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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
维护者通常 1 天内回复
-
[Doc] 官方文档中 S3 路径风格访问参数错误 (s3.use_path_style)可能已有人在做 @wy471x 于 6 天前认领。 未关闭
难度 2/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 半天 新手友好度 70/100
维护者通常 1 天内回复
-
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
维护者通常 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 ·