{"record":{"id":"f3298c658a4730bb","repo":"golang/go","slug":"symbol-s-section-number-d-is-larger-than-max-d-f3298c","errorCode":null,"errorMessage":"symbol %s: section number %d is larger than max %d","messagePattern":"symbol (.+?): section number (.+?) is larger than max (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/objfile/xcoff.go","lineNumber":119,"sourceCode":"\tsect := f.xcoff.Section(\".text\")\n\tif sect == nil {\n\t\treturn 0, nil, fmt.Errorf(\"text section not found\")\n\t}\n\ttextStart = sect.VirtualAddress\n\ttext, err = sect.Data()\n\treturn\n}\n\nfunc findXCOFFSymbol(f *xcoff.File, name string) (*xcoff.Symbol, error) {\n\tfor _, s := range f.Symbols {\n\t\tif s.Name != name {\n\t\t\tcontinue\n\t\t}\n\t\tif s.SectionNumber <= 0 {\n\t\t\treturn nil, fmt.Errorf(\"symbol %s: invalid section number %d\", name, s.SectionNumber)\n\t\t}\n\t\tif len(f.Sections) < s.SectionNumber {\n\t\t\treturn nil, fmt.Errorf(\"symbol %s: section number %d is larger than max %d\", name, s.SectionNumber, len(f.Sections))\n\t\t}\n\t\treturn s, nil\n\t}\n\treturn nil, fmt.Errorf(\"no %s symbol found\", name)\n}\n\nfunc loadXCOFFTable(f *xcoff.File, sname, ename string) ([]byte, error) {\n\tssym, err := findXCOFFSymbol(f, sname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tesym, err := findXCOFFSymbol(f, ename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ssym.SectionNumber != esym.SectionNumber {\n\t\treturn nil, fmt.Errorf(\"%s and %s symbols must be in the same section\", sname, ename)\n\t}","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/objfile/xcoff.go#L101-L137","documentation":"findXCOFFSymbol's second validation: after confirming SectionNumber > 0, it checks that SectionNumber <= len(f.Sections). If the symbol claims a section beyond what the file actually contains, the file is internally inconsistent and the lookup fails rather than index out of range.","triggerScenarios":"An XCOFF symbol whose SectionNumber is positive but greater than the number of sections in f.Sections.","commonSituations":"Corrupted or truncated XCOFF file whose section header table is incomplete relative to its symbol table, or an incompatible parser.","solutions":["Rebuild the AIX binary.","Verify file integrity with AIX tooling.","Ensure the Go toolchain's debug/xcoff version matches the binary producer."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// s, err := findXCOFFSymbol(f, name)\n// if err != nil {\n//     if strings.Contains(err.Error(), \"larger than max\") {\n//         // XCOFF is internally inconsistent; rebuild\n//     }\n//     return nil, err\n// }","preventionTips":["Rebuild AIX binaries from source rather than trusting edited files.","Validate XCOFF integrity with AIX tooling.","Match the debug/xcoff parser version to the producer."],"tags":["xcoff","aix","binary","objfile","corruption"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}