mirror of
https://github.com/morluto/rea.git
synced 2026-11-18 20:53:00 +00:00
fix(ntfs): reject unaligned USN v4 extents (#11969)
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
This commit is contained in:
1 parent
f52229a4a6
commit
7c25842bae
2 files changed
+9
-6
No files matched your search
@@ -131,13 +131,15 @@ it("bounds V4 extent delivery while retaining full coverage counts and continuat
|
||||
});
|
||||
|
||||
it.each([
|
||||
[15, 1],
|
||||
[16, 65535],
|
||||
[15, 1, 80],
|
||||
// Both 17-byte extents fit, so only the alignment check rejects this record.
|
||||
[17, 2, 104],
|
||||
[16, 65535, 80],
|
||||
])(
|
||||
"refuses V4 stride %i / count %i before extent allocation",
|
||||
(stride, count) => {
|
||||
const bytes = Buffer.alloc(80);
|
||||
bytes.writeUInt32LE(80);
|
||||
"refuses V4 stride %i / count %i in a %i-byte record before extent allocation",
|
||||
(stride, count, recordBytes) => {
|
||||
const bytes = Buffer.alloc(recordBytes);
|
||||
bytes.writeUInt32LE(bytes.length);
|
||||
bytes.writeUInt16LE(4, 4);
|
||||
bytes.writeUInt16LE(count, 60);
|
||||
bytes.writeUInt16LE(stride, 62);
|
||||
|
||||
@@ -147,6 +147,7 @@ const readExtentRecord = (
|
||||
// Validate the complete declared array before allocating the fixed-size sample.
|
||||
if (
|
||||
extentSize < 16 ||
|
||||
extentSize % 8 !== 0 ||
|
||||
extentCount > Math.floor((record.length - 64) / extentSize)
|
||||
)
|
||||
return err({ kind: "malformed", fileOffset });
|
||||
|
||||
Reference in new issue
Block a user