Open htoyama opened 2 months ago
2.7.0
Please attach your original Excel File to help us reproduce the issue
CheckPosition throw exception. NPOI.Util.RuntimeException: 'Buffer overrun i=4;endIndex=125635;writeIndex=125633'
diff --git a/main/HSSF/Record/AutoFilter/AutoFilterRecord.cs b/main/HSSF/Record/AutoFilter/AutoFilterRecord.cs index 227a4b1e..c43b9ca6 100644 --- a/main/HSSF/Record/AutoFilter/AutoFilterRecord.cs +++ b/main/HSSF/Record/AutoFilter/AutoFilterRecord.cs @@ -130,10 +130,25 @@ protected override int DataSize { int recSize = 2 + 2 + 10 + 10; if (field_3_doper1.LengthOfString > 0) - recSize += 1 + field_5_rgch1.Length; + if (rgch1_multibyte) + { + recSize += 1 + (field_5_rgch1.Length * 2); // UTF16LE + } + else + { + recSize += 1 + field_5_rgch1.Length; + } if(field_4_doper2.LengthOfString > 0) - recSize += 1+ field_6_rgch2.Length; + if (rgch2_multibyte) + { + recSize += 1+ (field_6_rgch2.Length * 2); // UTF16LE + + } + else + { + recSize += 1+ field_6_rgch2.Length; + } return recSize; } }
Book1.xls New serialize occur exception. Workbook.CloneSheet("Sheet1") Workbook.Write(New_File)
NPOI Version
2.7.0
File Type
Upload the Excel File
Please attach your original Excel File to help us reproduce the issue
Reproduce Steps
Issue Description
CheckPosition throw exception. NPOI.Util.RuntimeException: 'Buffer overrun i=4;endIndex=125635;writeIndex=125633'