GitHub Advisoryadvisory · Go
GHSA-g27h-8qhm-6pff Excelize: Panic in cellInRange on a worksheet with an empty mergeCell ref
MEDIUM
Official page ↗
- Aliases
- CVE-2026-107220
- Ecosystem
- Go
- Packages
- github.com/xuri/excelize/v2
- Severity
- Moderate
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
- Weaknesses
- CWE-125, CWE-129
- Reviewed
- 2026-10-07
Affected packages
• Go github.com/xuri/excelize/v2: >= 2.7.1, < 2.11.1-0.20260820023833-99903a3240e5 → fixed in 2.11.1-0.20260820023833-99903a3240e5
Description
Summary
A worksheet containing `` makes `mergeCellsParser` leave the cached rectangle empty, and `cellInRange` then indexes that empty slice without a length check. Every non-streaming cell API panics with `index out of range [0] with length 0` on the first cell read after opening the file.
Where it is
`cell.go`, `cellInRange`
func cellInRange(cell, ref []int) bool {
return cell[0] >= ref[0] && cell[0] = ref[1] && cell[1]
Then:
f, err := excelize.OpenReader(bytes.NewReader(data))
if err != nil { t.Fatal(err) }
_, _ = f.GetCellValue("Sheet1", "A1")
Observed, running against the repository at HEAD:
panic: runtime error: index out of range [0] with length 0
excelize.cellInRange cell.go:1691
excelize.(*xlsxWorksheet).mergeCellsParser cell.go:1660
excelize.(*File).getCellStringFunc cell.go:1512
excelize.(*File).GetCellValue cell.go:72
`OpenReader` itself returns no error; the file is 1656 bytes. A1, B1 and A2 all reproduce it.
For context on how targeted this is, I ran a battery of 38 crafted files covering data validation, conditional formatting, cell and row references, number formats, cols, hyperlinks, dimension, shared strings and tables. Only the empty-ref merge cell panicked; everything else returned a clean error. The other parsing paths look well guarded.
Suggested fix
Skip the entry when the rectangle is empty, before the range test:
if len(ws.MergeCells.Cells[i].rect) == 0 {
continue
}
Credit goes to arpitjain099.
Related
Alias · CVE (1)
- CVE-2026-107220 Excelize is a Go language library for reading and writing Microsoft Excel spreadsheets. vulnerability