Skip to content
Heist/ feed
Back to feed
MediumFix available

Excelize: Panic in cellInRange on a worksheet with an empty mergeCell ref

Type: advisorySources: OSV

### 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[2] && cell[1] >= ref[1] && cell[1] <= ref[3] } `ref` is indexed at four positions with no bounds check. The caller that can hand it an empty slice, `mergeCellsParser` if ref := ws.MergeCells.Cells[i].Ref; len(ws.MergeCells.Cells[i].rect) == 0 && ref != "" { if strings.Count(ref, ":") != 1 { ref += ":" + ref } rect, err := rangeRefToCoordinates(ref) if err != nil { return cell, err } _ = sortCoordinates(rect) ws.MergeCells.Cells[i].rect = rect } if cellInRange([]int{col, row}, ws.MergeCells.Cells[i].rect) { The `ref != ""` condition means an empty `ref` skips the block that populates `rect`, so `rect` stays nil. The `cellInRange` call on the next line is unconditional and receives that nil slice. `Ref` comes straight from `xl/worksheets/sheetN.xml` through `encoding/xml`, so an empty string is entirely attacker-controlled. ### Impact Any consumer that opens an untrusted workbook and reads a cell panics. The loop scans every merged cell, so any cell reference triggers it, not a specific one. Affected entry points include `GetCellValue`, `GetCellType`, `GetCellFormu

Products
github.com/xuri/excelize/v2
Affected versions
Not specified
Fixed versions
2.11.1-0.20260820023833-99903a3240e5
CVEs
CVE-2026-107220
Confirmed fixed CVEs
Not specified
Updated in this feed
28 Oct 2026, 08:47 UTC · Revision 1

Source evidence

Excelize: Panic in cellInRange on a worksheet with an empty mergeCell ref

core-osv · Original source

Published 7 Oct 2026, 20:23 UTC

### 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[2] && cell[1] >= ref[1] && cell[1] <= ref[3] } `ref` is indexed at four positions with no bounds check. The caller that can hand it an empty slice, `mergeCellsParser` if ref := ws.MergeCells.Cells[i].Ref; len(ws.MergeCells.Cells[i].rect) == 0 && ref != "" { if strings.Count(ref, ":") != 1 { ref += ":" + ref } rect, err := rangeRefToCoordinates(ref) if err != nil { return cell, err } _ = sortCoordinates(rect) ws.MergeCells.Cells[i].rect = rect } if cellInRange([]int{col, row}, ws.MergeCells.Cells[i].rect) { The `ref != ""` condition means an empty `ref` skips the block that populates `rect`, so `rect` stays nil. The `cellInRange` call on the next line is unconditional and receives that nil slice. `Ref` comes straight from `xl/worksheets/sheetN.xml` through `encoding/xml`, so an empty string is entirely attacker-controlled. ### Impact Any consumer that opens an untrusted workbook and reads a cell panics. The loop scans every merged cell, so any cell reference triggers it, not a specific one. Affected entry points include `GetCellValue`, `GetCellType`, `GetCellFormu

osv:GHSA-g27h-8qhm-6pff

github.com/xuri/excelize/v2

Fixed versions: 2.11.1-0.20260820023833-99903a3240e5

Complete source record
{
  "id": "befa9aaa92a1ad0bac1f08944db2b95f3e79043e21a4efa9b184416c6583c621",
  "url": "https://osv.dev/vulnerability/GHSA-g27h-8qhm-6pff",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Excelize: Panic in cellInRange on a worksheet with an empty mergeCell ref",
    "summary": "### 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[2] && cell[1] >= ref[1] && cell[1] <= ref[3] } `ref` is indexed at four positions with no bounds check. The caller that can hand it an empty slice, `mergeCellsParser` if ref := ws.MergeCells.Cells[i].Ref; len(ws.MergeCells.Cells[i].rect) == 0 && ref != \"\" { if strings.Count(ref, \":\") != 1 { ref += \":\" + ref } rect, err := rangeRefToCoordinates(ref) if err != nil { return cell, err } _ = sortCoordinates(rect) ws.MergeCells.Cells[i].rect = rect } if cellInRange([]int{col, row}, ws.MergeCells.Cells[i].rect) { The `ref != \"\"` condition means an empty `ref` skips the block that populates `rect`, so `rect` stays nil. The `cellInRange` call on the next line is unconditional and receives that nil slice. `Ref` comes straight from `xl/worksheets/sheetN.xml` through `encoding/xml`, so an empty string is entirely attacker-controlled. ### Impact Any consumer that opens an untrusted workbook and reads a cell panics. The loop scans every merged cell, so any cell reference triggers it, not a specific one. Affected entry points include `GetCellValue`, `GetCellType`, `GetCellFormu",
    "evidence": "osv:GHSA-g27h-8qhm-6pff",
    "products": [
      {
        "name": {
          "value": "github.com/xuri/excelize/v2",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "2.11.1-0.20260820023833-99903a3240e5",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "medium",
    "structured": {
      "id": "GHSA-g27h-8qhm-6pff",
      "aliases": [
        "CVE-2026-107220",
        "GHSA-g27h-8qhm-6pff"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "2.7.1"
                },
                {
                  "fixed": "2.11.1-0.20260820023833-99903a3240e5"
                }
              ]
            }
          ],
          "package": {
            "name": "github.com/xuri/excelize/v2",
            "purl": "pkg:golang/github.com/xuri/excelize/v2",
            "ecosystem": "Go"
          },
          "database_specific": {
            "source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-g27h-8qhm-6pff/GHSA-g27h-8qhm-6pff.json"
          }
        }
      ],
      "modified": "2026-10-07T20:30:07.235710736Z",
      "provider": "osv",
      "references": [
        "https://github.com/qax-os/excelize/security/advisories/GHSA-g27h-8qhm-6pff",
        "https://github.com/qax-os/excelize/pull/2379",
        "https://github.com/qax-os/excelize/commit/99903a3240e58a47ff28fb8e05a03bd9d496ec24",
        "https://github.com/qax-os/excelize"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-125",
          "CWE-129"
        ],
        "severity": "MODERATE",
        "github_reviewed": true,
        "nvd_published_at": null,
        "github_reviewed_at": "2026-10-07T20:23:17Z"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-107220",
        "evidence": "/aliases"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 97242,
  "published_at": "2026-10-07T20:23:17+00:00"
}