{"record":{"id":"3f31e9d3e029e6aa","repo":"QL-Win/QuickLook","slug":"the-file-does-not-have-a-minidump-signature","errorCode":null,"errorMessage":"The file does not have a minidump signature.","messagePattern":"The file does not have a minidump signature\\.","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"QuickLook.Plugin/QuickLook.Plugin.DumpViewer/MinidumpReader.cs","lineNumber":113,"sourceCode":"    {\n        if (fileLength < HeaderSize)\n            throw new InvalidDataException(\"The file is too small to be a minidump.\");\n\n        reader.BaseStream.Position = 0;\n\n        var header = new MinidumpHeader\n        {\n            Signature = reader.ReadUInt32(),\n            Version = reader.ReadUInt32(),\n            NumberOfStreams = reader.ReadUInt32(),\n            StreamDirectoryRva = reader.ReadUInt32(),\n            CheckSum = reader.ReadUInt32(),\n            TimeDateStamp = reader.ReadUInt32(),\n            Flags = reader.ReadUInt64(),\n        };\n\n        if (header.Signature != MinidumpSignature)\n            throw new InvalidDataException(\"The file does not have a minidump signature.\");\n\n        var directoryBytes = (long)header.NumberOfStreams * DirectoryEntrySize;\n        if (!CanRead(fileLength, header.StreamDirectoryRva, directoryBytes))\n            throw new InvalidDataException(\"The minidump stream directory is outside the file.\");\n\n        return header;\n    }\n\n    private static IEnumerable<MinidumpDirectory> ReadDirectories(BinaryReader reader, long fileLength, MinidumpHeader header)\n    {\n        reader.BaseStream.Position = header.StreamDirectoryRva;\n\n        for (var i = 0; i < header.NumberOfStreams; i++)\n        {\n            var directory = new MinidumpDirectory\n            {\n                Type = (MinidumpStreamType)reader.ReadUInt32(),\n                DataSize = reader.ReadUInt32(),","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/QL-Win/QuickLook/blob/cb5d9c429c81d9796fac469da2a68efb5626946d/QuickLook.Plugin/QuickLook.Plugin.DumpViewer/MinidumpReader.cs#L95-L131","documentation":"Thrown after the 32-byte header is read: the Signature field (first UInt32) did not equal MinidumpSignature (0x504D444D, ASCII 'MDMP'). Every legitimate Windows minidump begins with 'MDMP', so a mismatch means the file is not a minidump despite being large enough.","triggerScenarios":"ReadHeader reads the first 4 bytes and they are not 0x504D444D. Typical when a full-size non-dump file (e.g. a large .exe, .pdb, or text log misnamed .dmp) is fed to the reader.","commonSituations":"A user renamed an arbitrary file to .dmp; a debugger wrote a different format (e.g. a 'triage' or a raw memory snapshot without the MDMP header); a full-user-dump from a non-Microsoft tool that uses a custom container.","solutions":["Use MinidumpReader.IsMinidump(path) — it reads only the first UInt32 and compares to 0x504D444D — before attempting full parse.","Verify the producer: generate dumps with tools that emit MDMP (Task Manager 'Create dump file', procdump, WER, or DbgHelp MiniDumpWriteDump).","Catch InvalidDataException in the preview host and treat as 'unsupported format'.","If a different dump format is intended, route to the correct reader instead of MinidumpReader."],"exampleFix":"// before\nvar header = ReadHeader(reader, stream.Length);\n\n// after\nif (!MinidumpReader.IsMinidump(path)) return;\nvar header = ReadHeader(reader, stream.Length);","handlingStrategy":"validation","validationCode":"if (!MinidumpReader.IsMinidump(path)) return; // checks first 4 bytes == 'MDMP'","typeGuard":"static bool HasMdmpSignature(byte[] head) => head.Length >= 4 && head[0]=='M' && head[1]=='D' && head[2]=='M' && head[3]=='P';","tryCatchPattern":"try { var info = MinidumpReader.Read(path); }\ncatch (InvalidDataException ex) when (ex.Message.Contains(\"signature\")) { /* unsupported format */ }","preventionTips":["Generate dumps only with MDMP-emitting tools (MiniDumpWriteDump, procdump, Task Manager).","Sniff the 'MDMP' magic before full parse.","Don't route arbitrary .dmp-named files to DumpViewer without a signature check."],"tags":["minidump","signature","windows","binary-parsing"],"backgroundTag":null,"analyzedSha":"cb5d9c429c81d9796fac469da2a68efb5626946d","analyzedAt":"2026-08-13T11:51:01.370Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}