Skip to content

fix the OOB buffer access issue in src/text/draw.rs when switching to text view at the end of the file#40

Merged
merces merged 3 commits intomentebinaria:mainfrom
yeggor:fix/oob
Feb 19, 2026
Merged

fix the OOB buffer access issue in src/text/draw.rs when switching to text view at the end of the file#40
merces merged 3 commits intomentebinaria:mainfrom
yeggor:fix/oob

Conversation

@yeggor
Copy link
Contributor

@yeggor yeggor commented Feb 18, 2026

If you open a file larger than area.height * area.width and go to the last page (G), then switch to text view (Enter), you should get a similar panic:

> dz6 rand.bin

thread 'main' (27108978) panicked at src/text/draw.rs:17:24:
range end index 30497841225 out of range for slice of length 30497832960
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

In this PR I am fixing the issue.

NOTE: should be merged on top of #39.

initial approach via .windows(siz) is too slow on huge files
at the end of file with size > area.height * area.width
@merces
Copy link
Member

merces commented Feb 19, 2026

Thanks a lot!

@merces merces merged commit 9875836 into mentebinaria:main Feb 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants