{"record":{"id":"dc2266c44fae6efc","repo":"golang/go","slug":"corrupt-pointer-found-in-go-fipsinfo","errorCode":null,"errorMessage":"corrupt pointer found in go:fipsinfo","messagePattern":"corrupt pointer found in go:fipsinfo","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/link/internal/ld/fips140.go","lineNumber":570,"sourceCode":"\t//\t.data (file) Size = 0x1fc00\n\t//\tgo:fipsinfo found at offset 0x2ac5e0 (off=0x1e0)\n\t//\tgo:fipsinfo self pointer = 0x01402af1e0\n\t//\n\t// From the section headers, the address of the go:fipsinfo symbol\n\t// should be 0x2af000 + (0x2ac5e0 - 0x2ac400) = 0x2af1e0,\n\t// yet in this case its pointer is 0x1402af1e0, meaning the\n\t// data section's VirtualAddress is really 0x1402af000.\n\t// This is not (only) a 32-bit truncation problem, since the uint32\n\t// truncation of that address would be 0x402af000, not 0x2af000.\n\t// Perhaps there is some 64-bit extension that debug/pe is not\n\t// reading or is misreading. In any event, we can derive the delta\n\t// between computed VirtualAddress and listed VirtualAddress\n\t// and apply it to the rest of the pointers.\n\t// As a sanity check, the low 12 bits (virtual page offset)\n\t// must match between our computed address and the actual one.\n\tpeself := int64(sect.VirtualAddress) + off\n\tif self&0xfff != off&0xfff {\n\t\treturn fmt.Errorf(\"corrupt pointer found in go:fipsinfo\")\n\t}\n\tdelta := peself - self\n\nAddrs:\n\tfor i := 0; i < 4; i++ {\n\t\tstart := int64(uptr(data[0:])) + delta\n\t\tend := int64(uptr(data[ctxt.Arch.PtrSize:])) + delta\n\t\tdata = data[2*ctxt.Arch.PtrSize:]\n\t\tfor _, sect := range pf.Sections {\n\t\t\tif int64(sect.VirtualAddress) <= start && start <= end && end <= int64(sect.VirtualAddress)+int64(sect.Size) {\n\t\t\t\toff := int64(sect.Offset) - int64(sect.VirtualAddress)\n\t\t\t\tif err := f.addSection(start+off, end+off); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcontinue Addrs\n\t\t\t}\n\t\t}\n\t\treturn fmt.Errorf(\"invalid pointers found in go:fipsinfo\")","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/link/internal/ld/fips140.go#L552-L588","documentation":"During PE FIPS post-link processing, the code derives a self-pointer from the PE section's VirtualAddress plus the scan offset, then performs a sanity check: the low 12 bits (virtual page offset) of the computed self-address must match the low 12 bits of the scan offset. If they differ, the pointer is considered corrupt, indicating a mismatch between the PE layout and the fipsinfo data.","triggerScenarios":"peself is computed as int64(sect.VirtualAddress) + off. The code checks self & 0xfff != off & 0xfff. If the page-offset bits don't align, the error fires. This can happen when the PE VirtualAddress has unexpected high bits (as noted in the source comments about 64-bit extension issues in debug/pe) or when the delta between computed and actual addresses breaks the low-bit invariant.","commonSituations":"A bug in Go's debug/pe library that misreads VirtualAddress for large 64-bit addresses (as noted in the source comments about 0x1402af1e0 addresses); unusual PE section alignment; binary modified by tools that change section virtual addresses; mismatch between the linker's PE writer and the post-link reader's address interpretation.","solutions":["Clean rebuild: go clean -cache && GOFIPS=1 go build","Report as a Go linker bug at https://github.com/golang/go/issues with the binary and PE section details","Check if the PE binary uses large-image (>4GB virtual address) layout that may confuse debug/pe","Verify no post-build tools (editbin, PE rewriters) modified section addresses","Try a different Go version — this may be fixed in newer releases that handle 64-bit PE addresses"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Handle corrupt pointer with diagnostic context\nif self&0xfff != off&0xfff {\n    return fmt.Errorf(\"corrupt pointer in go:fipsinfo (PE VA=%#x, off=%#x) — try clean rebuild or report Go bug\", sect.VirtualAddress, off)\n}","preventionTips":["Do not modify PE section virtual addresses with tools like editbin after linking","Ensure the binary is produced by a standard Go build without external PE manipulation","Try newer Go versions — PE 64-bit address handling bugs may be fixed","Report the PE section layout details when filing a Go bug report"],"tags":["fips","fips140","pe","linker","go-toolchain","pointer-corruption","windows"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:17:08.281Z"}