QL-Win/QuickLook · error · InvalidDataException

The minidump stream directory is outside the file.

Error message

The minidump stream directory is outside the file.

What it means

Thrown when the stream directory described by the header does not fit inside the file. After validating the MDMP signature, the reader computes directoryBytes = NumberOfStreams * 12 and checks CanRead(fileLength, StreamDirectoryRva, directoryBytes); a false result means the directory region starts beyond EOF or overruns it. This indicates a truncated or structurally corrupt minidump.

Source

Thrown at QuickLook.Plugin/QuickLook.Plugin.DumpViewer/MinidumpReader.cs:117

        reader.BaseStream.Position = 0;

        var header = new MinidumpHeader
        {
            Signature = reader.ReadUInt32(),
            Version = reader.ReadUInt32(),
            NumberOfStreams = reader.ReadUInt32(),
            StreamDirectoryRva = reader.ReadUInt32(),
            CheckSum = reader.ReadUInt32(),
            TimeDateStamp = reader.ReadUInt32(),
            Flags = reader.ReadUInt64(),
        };

        if (header.Signature != MinidumpSignature)
            throw new InvalidDataException("The file does not have a minidump signature.");

        var directoryBytes = (long)header.NumberOfStreams * DirectoryEntrySize;
        if (!CanRead(fileLength, header.StreamDirectoryRva, directoryBytes))
            throw new InvalidDataException("The minidump stream directory is outside the file.");

        return header;
    }

    private static IEnumerable<MinidumpDirectory> ReadDirectories(BinaryReader reader, long fileLength, MinidumpHeader header)
    {
        reader.BaseStream.Position = header.StreamDirectoryRva;

        for (var i = 0; i < header.NumberOfStreams; i++)
        {
            var directory = new MinidumpDirectory
            {
                Type = (MinidumpStreamType)reader.ReadUInt32(),
                DataSize = reader.ReadUInt32(),
                Rva = reader.ReadUInt32(),
            };

            if (directory.DataSize == 0 || CanRead(fileLength, directory.Rva, directory.DataSize))

View on GitHub (pinned to cb5d9c429c)

Solutions

  1. Re-capture the dump ensuring the writer completes (check the file stops growing / writer process exits cleanly).
  2. Validate integrity with a debugger (WinDbg/cdb -z) — if it also rejects the file, the dump is irrecoverable.
  3. Add a pre-check: ensure StreamDirectoryRva + (long)NumberOfStreams * 12 <= fileLength before trusting the header.
  4. Catch InvalidDataException and surface 'corrupt or incomplete minidump' to the user.

Example fix

// before
var directoryBytes = (long)header.NumberOfStreams * DirectoryEntrySize;
if (!CanRead(fileLength, header.StreamDirectoryRva, directoryBytes))
    throw new InvalidDataException("...");

// after — caller-side guard before parsing
long need = (long)header.NumberOfStreams * 12 + header.StreamDirectoryRva;
if (need > new FileInfo(path).Length) { /* not a complete dump */ }
Defensive patterns

Strategy: validation

Validate before calling

// before parsing, ensure the header's directory region fits the file
long len = new FileInfo(path).Length;
// (after reading header) check: header.StreamDirectoryRva + (long)header.NumberOfStreams*12 <= len

Try / catch

try { var info = MinidumpReader.Read(path); }
catch (InvalidDataException ex) when (ex.Message.Contains("outside the file")) { /* corrupt/truncated dump */ }

Prevention

When it happens

Trigger: header.NumberOfStreams or header.StreamDirectoryRva hold bogus/huge values (e.g. from a partially written dump), or the file was cut short so the directory region (RVA + NumberOfStreams*12) extends past fileLength.

Common situations: A crash dump captured while the process was still being written and then the dumper died; disk-full during dump write; a minidump copied incompletely; bit-rot in NumberOfStreams producing an absurd count.

Related errors


AI-assisted analysis of QL-Win/QuickLook@cb5d9c429c (2026-08-13). Data as JSON: /api/errors/d4fdc329f5e399c6. Report an issue: GitHub.