🔴 [H3] 缓存损坏时 get_line() 会 panic #3
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
文件:
core/io/line_index.rs:236分类: 缓存 / 健壮性
问题:
get_line()直接用self.sampled_offsets[block]索引,不检查越界。如果 bincode 缓存被损坏,普通查询会 运行时 panic 而非返回错误。建议修复: 添加
LineIndex::validate(data_len)方法;缓存加载后校验;guardsampled_offsets.get(block)。修复信息:
bef0b44fix(io): guard sampled_offsets index in get_line() to prevent panic on corrupt cacheself.sampled_offsets[block]直接索引替换为self.sampled_offsets.get(block)?,越界时返回None而非 panic