{"record":{"id":"9e31992bc97c104e","repo":"golang/go","slug":"invalid-section-number-in-symbol-table-9e3199","errorCode":null,"errorMessage":"invalid section number in symbol table","messagePattern":"invalid section number in symbol table","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/objfile/xcoff.go","lineNumber":48,"sourceCode":"\tvar syms []Sym\n\tfor _, s := range f.xcoff.Symbols {\n\t\tconst (\n\t\t\tN_UNDEF = 0  // An undefined (extern) symbol\n\t\t\tN_ABS   = -1 // An absolute symbol (e_value is a constant, not an address)\n\t\t\tN_DEBUG = -2 // A debugging symbol\n\t\t)\n\t\tsym := Sym{Name: s.Name, Addr: s.Value, Code: '?'}\n\n\t\tswitch s.SectionNumber {\n\t\tcase N_UNDEF:\n\t\t\tsym.Code = 'U'\n\t\tcase N_ABS:\n\t\t\tsym.Code = 'C'\n\t\tcase N_DEBUG:\n\t\t\tsym.Code = '?'\n\t\tdefault:\n\t\t\tif s.SectionNumber < 0 || len(f.xcoff.Sections) < s.SectionNumber {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid section number in symbol table\")\n\t\t\t}\n\t\t\tsect := f.xcoff.Sections[s.SectionNumber-1]\n\n\t\t\t// debug/xcoff returns an offset in the section not the actual address\n\t\t\tsym.Addr += sect.VirtualAddress\n\n\t\t\tif s.AuxCSect.SymbolType&0x3 == xcoff.XTY_LD {\n\t\t\t\t// The size of a function is contained in the\n\t\t\t\t// AUX_FCN entry\n\t\t\t\tsym.Size = s.AuxFcn.Size\n\t\t\t} else {\n\t\t\t\tsym.Size = s.AuxCSect.Length\n\t\t\t}\n\n\t\t\tsym.Size = s.AuxCSect.Length\n\n\t\t\tswitch sect.Type {\n\t\t\tcase xcoff.STYP_TEXT:","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/objfile/xcoff.go#L30-L66","documentation":"While mapping XCOFF (AIX) symbols into the objfile Sym form, the code resolves each symbol's section by 1-based index. After handling the special N_UNDEF/N_ABS/N_DEBUG cases, any SectionNumber that is negative or larger than the number of sections in the file is rejected as corrupt, since indexing f.xcoff.Sections would be out of range.","triggerScenarios":"Iterating XCOFF symbols where a symbol's SectionNumber is not one of the special constants and falls outside [1, len(f.xcoff.Sections)].","commonSituations":"A corrupted or hand-edited XCOFF binary, a truncated file whose section table was cut off, or a mismatched/incompatible debug/xcoff parser version.","solutions":["Rebuild the AIX (ppc/ppc64) binary cleanly.","Verify the file with AIX tooling (e.g. 'dump') before inspection.","Ensure you are using a Go toolchain version whose debug/xcoff matches the binary's producer."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// syms, err := xf.symbols()\n// if err != nil {\n//     if strings.Contains(err.Error(), \"invalid section number\") {\n//         // XCOFF symbol table is internally inconsistent; rebuild\n//     }\n//     return nil, err\n// }","preventionTips":["Rebuild AIX binaries cleanly rather than reusing edited ones.","Validate XCOFF files with AIX 'dump' before inspection.","Keep the Go toolchain version consistent with the binary producer."],"tags":["xcoff","aix","binary","objfile","section"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}