fix(entropy): name offset when the byte window starts past EOF (#6495)

Fixes #6482

Co-authored-by: Abelo9996 <Abelo9996@users.noreply.github.com>
This commit is contained in:
Abel YagubyanandAbelo9996 authored and GitHub committed 2026-10-23 23:42:07 +09:00
1 parent 8f91e60558
commit e8dad898da
3 files changed
+23 -2

No files matched your search

@@ -202,8 +202,13 @@ export class ByteEntropyService {
"path",
"File size exceeds exact numeric offset representation.",
);
if (input.offset > size)
throw invalid(
"offset",
"Selected byte window starts beyond the end of the file.",
);
const length = input.length ?? size - input.offset;
if (input.offset > size || length > size - input.offset)
if (length > size - input.offset)
throw invalid(
"length",
"Selected byte window extends beyond the end of the file.",