{"record":{"id":"ed0a8b68285008c7","repo":"go-delve/delve","slug":"location-starting-at-x-of-size-x-is-past-the-e","errorCode":null,"errorMessage":"location starting at %#x of size %#x is past the end of file, while %s","messagePattern":"location starting at %#x of size %#x is past the end of file, while (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/core/minidump/minidump.go","lineNumber":503,"sourceCode":"\t\tstream.Offset, stream.RawData = readLocationDescriptor(buf)\n\t\tif buf.err != nil {\n\t\t\treturn\n\t\t}\n\t}\n}\n\n// readLocationDescriptor reads a location descriptor structure (a structure\n// which describes a subregion of the file), and returns the destination\n// offset and a slice into the minidump file's buffer.\nfunc readLocationDescriptor(buf *minidumpBuf) (off int, rawData []byte) {\n\tsz := buf.u32()\n\toff = int(buf.u32())\n\tif buf.err != nil {\n\t\treturn off, nil\n\t}\n\tend := off + int(sz)\n\tif off >= len(buf.buf) || end > len(buf.buf) {\n\t\tbuf.err = fmt.Errorf(\"location starting at %#x of size %#x is past the end of file, while %s\", off, sz, buf.ctx)\n\t\treturn 0, nil\n\t}\n\trawData = buf.buf[off:end]\n\treturn\n}\n\nfunc readString(buf *minidumpBuf) string {\n\tstartOff := buf.off\n\tsz := buf.u32()\n\tif buf.err != nil {\n\t\treturn \"\"\n\t}\n\tend := buf.off + int(sz)\n\tif buf.off >= len(buf.buf) || end > len(buf.buf) {\n\t\tbuf.err = fmt.Errorf(\"string starting at %#x of size %#x is past the end of file, while %s\", startOff, sz, buf.ctx)\n\t\treturn \"\"\n\t}\n\treturn decodeUTF16(buf.buf[buf.off:end])","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/core/minidump/minidump.go#L485-L521","documentation":"While parsing a minidump's data structures, a location (file offset + size) read from the dump points at or beyond the actual file length. The dumpBuffer guards every bounded read and records this error in buf.err, aborting parsing. It means the file's internal offsets are inconsistent with its size, i.e. the dump is truncated or corrupt.","triggerScenarios":"Calling proc.LoadMiniDumpFile on a minidump where a descriptor's offset (read via buf.u32()) plus its size exceeds len(buf.buf); typically hit while parsing memory streams, module data, or thread context locations.","commonSituations":"A minidump truncated by an incomplete file copy/upload, a dump written while the process was still crashing, cloud storage that cut the file off, or a hand-edited/corrupted dump.","solutions":["Re-capture the minidump; ensure the transfer completed (compare byte sizes / checksums between producer and consumer).","Open the dump in WinDbg or dumpchk to confirm which stream is damaged.","If truncated mid-transfer, re-download or restore the original copy.","If producing dumps programmatically (MiniDumpWriteDump), ensure the write completes and the handle is flushed/closed before shipping."],"exampleFix":"// before: loading a truncated dump\ncore, err := proc.LoadMiniDumpFile(\"truncated.dmp\", nil, 0)\n\n// after: verify the file is complete first\nfi, _ := os.Stat(\"full.dmp\")\nif fi.Size() < expectedMinSize { log.Fatal(\"dump truncated\") }\ncore, err := proc.LoadMiniDumpFile(\"full.dmp\", nil, 0)","handlingStrategy":"validation","validationCode":"func dumpLooksIntact(path string, minExpected int64) error {\n    fi, err := os.Stat(path)\n    if err != nil { return err }\n    if fi.Size() < minExpected {\n        return fmt.Errorf(\"dump %s is %d bytes, expected at least %d - likely truncated\", path, fi.Size(), minExpected)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"core, err := proc.LoadMiniDumpFile(dumpPath, logfn, 0)\nif err != nil {\n    if strings.Contains(err.Error(), \"past the end of file\") {\n        return fmt.Errorf(\"minidump %s is truncated or corrupt; re-capture it (cause: %w)\", dumpPath, err)\n    }\n    return err\n}","preventionTips":["Verify file size and checksum (SHA-256) between producer and consumer before analysis.","Avoid copying dumps while they are still being written; flush/close handles first.","Store dumps in archives and verify archive integrity after transfer.","Alert on uploads that end below the size recorded at capture time."],"tags":["minidump","corrupt-file","truncated","bounds-check"],"backgroundTag":"minidump-offset-past-eof","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}