Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge commits from TheXDS/EPPlus #1

Merged
merged 20 commits into from
Jul 31, 2023
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
354c844
REPAIRED METHOD - internal ExcelBorderItemXml Copy()
Sep 5, 2018
1ef3966
Add properties for image dimensions: Properties for a resized image's…
Jun 7, 2019
fb1f7e0
Prevent index out of array bounds exception
mason-mcglothlin Jun 7, 2019
1ddba00
Fixed issue in formula match
leonardopinho Jul 13, 2019
f1e36ae
Fix issue #152 Posibility to ignore Microsoft Excel cells warning err…
romcode Sep 3, 2019
03c8dca
Added async method one ExcelPackage
bhugot Dec 5, 2019
2e140bb
changed FileStream creation
bhugot Dec 5, 2019
aa9e9ca
Add Net Core 2.2, 3.0, 3.1 and Net Standard 2.1 targets
TheXDS Jan 15, 2020
c51ce64
Removal of net35 target
TheXDS Jan 15, 2020
1ff6e5d
Fixed problem with namespace prefix for sheetData tag in worksheet.
Michael-Greiner Jan 16, 2020
0d692a2
Merge branch 'master' into master
TheXDS Jan 30, 2020
4938e05
Removal of duplicate propertygroup for netstd2.1
TheXDS Jan 30, 2020
fe2a890
Merge pull request #1 from Michael-Greiner/master
TheXDS Jan 30, 2020
1422d3a
Merge pull request #2 from bhugot/Async_Methods
TheXDS Jan 30, 2020
ad573a5
Merge pull request #3 from romcode/manage-cells-warning-errors
TheXDS Jan 30, 2020
e6e79bc
Merge pull request #4 from leonardopinho/master
TheXDS Jan 30, 2020
7b48a5a
Merge pull request #5 from billgeek/MergeCellsFix
TheXDS Jan 30, 2020
d755ae1
Merge pull request #6 from mason-mcglothlin/master
TheXDS Jan 30, 2020
bf92ef1
Merge pull request #7 from PeterHevesi/ExcelBorderItemXml_Fix
TheXDS Jan 30, 2020
a277715
Minor compilation fixes
TheXDS Jan 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Prevent index out of array bounds exception
Convert short to int because we were overflowing the value and this was causing and index out of bounds exception when accessing an array. Eliminated unnecessary cast
  • Loading branch information
mason-mcglothlin authored Jun 7, 2019
commit fb1f7e0a4cf242d954499e917bf7b8cc13673861
19 changes: 8 additions & 11 deletions EPPlus/CellStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using OfficeOpenXml;
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;

internal class IndexBase : IComparable<IndexBase>
{
Expand All @@ -53,7 +50,7 @@ internal int IndexPointer
get;
set;
}
internal short Index;
internal int Index;
public int CompareTo(IndexItem other)
{
return Index - other.Index;
Expand Down Expand Up @@ -653,7 +650,7 @@ internal void SetValue(int Row, int Column, T Value)
pageItem = _columnIndex[col]._pages[pos];
}

short ix = (short)(Row - ((pageItem.Index << pageBits) + pageItem.Offset));
int ix = Row - ((pageItem.Index << pageBits) + pageItem.Offset);
_searchItem.Index = ix;
var cellPos = Array.BinarySearch(pageItem.Rows, 0, pageItem.RowCount, _searchItem);
if (cellPos < 0)
Expand All @@ -671,7 +668,7 @@ internal void SetValue(int Row, int Column, T Value)
col = ~col;
AddColumn(col, Column);
AddPage(_columnIndex[col], 0, page);
short ix = (short)(Row - (page << pageBits));
int ix = Row - (page << pageBits);
AddCell(_columnIndex[col], 0, 0, ix, Value);
}
}
Expand Down Expand Up @@ -742,7 +739,7 @@ internal void SetRangeValueSpecial(int fromRow, int fromColumn, int toRow, int t
pageItem = _columnIndex[col]._pages[pos];
}

short ix = (short)(rowIx - ((pageItem.Index << pageBits) + pageItem.Offset));
int ix = rowIx - ((pageItem.Index << pageBits) + pageItem.Offset);
_searchItem.Index = ix;
var cellPos = Array.BinarySearch(pageItem.Rows, 0, pageItem.RowCount, _searchItem);
if (cellPos < 0)
Expand All @@ -761,7 +758,7 @@ internal void SetRangeValueSpecial(int fromRow, int fromColumn, int toRow, int t
col = ~col;
AddColumn(col, colIx);
AddPage(_columnIndex[col], 0, page);
short ix = (short)(rowIx - (page << pageBits));
int ix = rowIx - (page << pageBits);
AddCell(_columnIndex[col], 0, 0, ix, default(T));
Updater(_values, _columnIndex[col]._pages[0].Rows[0].IndexPointer, rowIx, colIx, Value);
}
Expand Down Expand Up @@ -812,7 +809,7 @@ internal void SetValueSpecial(int Row, int Column, SetValueDelegate Updater, obj
pageItem = _columnIndex[col]._pages[pos];
}

short ix = (short)(Row - ((pageItem.Index << pageBits) + pageItem.Offset));
int ix = Row - ((pageItem.Index << pageBits) + pageItem.Offset);
_searchItem.Index = ix;
var cellPos = Array.BinarySearch(pageItem.Rows, 0, pageItem.RowCount, _searchItem);
if (cellPos < 0)
Expand All @@ -831,7 +828,7 @@ internal void SetValueSpecial(int Row, int Column, SetValueDelegate Updater, obj
col = ~col;
AddColumn(col, Column);
AddPage(_columnIndex[col], 0, page);
short ix = (short)(Row - (page << pageBits));
int ix = Row - (page << pageBits);
AddCell(_columnIndex[col], 0, 0, ix, default(T));
Updater(_values, _columnIndex[col]._pages[0].Rows[0].IndexPointer, Value);
}
Expand Down Expand Up @@ -1421,7 +1418,7 @@ internal static int GetSize(int size)
}
return newSize;
}
private void AddCell(ColumnIndex columnIndex, int pagePos, int pos, short ix, T value)
private void AddCell(ColumnIndex columnIndex, int pagePos, int pos, int ix, T value)
{
PageIndex pageItem = columnIndex._pages[pagePos];
if (pageItem.RowCount == pageItem.Rows.Length)
Expand Down