The vulnerability, CVE-2026-107222, in github.com/xuri/excelize/v2 is a denial-of-service issue caused by insufficient input validation and bounds checking when parsing conditional formatting rules from Excel files. The GetConditionalFormats function, which is responsible for extracting these rules, calls several sub-functions (extractCondFmtCellIs, extractCondFmtColorScale, and extractCondFmtDataBar). These sub-functions directly access array elements or dereference pointers without adequate checks for nil values or slice lengths. This allows an attacker to craft a malformed .xlsx file that, when processed by a service using excelize, will cause a runtime panic (either 'index out of range' or 'nil pointer dereference'), leading to a denial of service.
The provided patch clearly demonstrates the introduction of nil checks (e.g., if c.ColorScale == nil) and length checks (e.g., if len(c.Formula) > 0, len(c.DataBar.Cfvo) > 1, len(c.DataBar.Color) > 0, values > 2) before accessing array elements or dereferencing pointers. These additions directly address the missing validations that led to the panics. The GetConditionalFormats function is identified as vulnerable because it is the public API that orchestrates the parsing process and, in its unpatched state, would invoke the vulnerable sub-functions with potentially malicious input, leading to the described panics.