Skip to content
New issue

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

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

Already on GitHub? # to your account

Incorrect array bounds check in NPOI.XSSF.Model.StylesTable.GetCellStyleXfAt #892

Closed
aboryczko opened this issue Jul 23, 2022 · 0 comments
Closed

Comments

@aboryczko
Copy link

Hi,
I was trying to use the the Npoi.Mapper library on an XLSX file generated by LargeXlsx which generates a very basic style sheet file which doesn't contain any cellStyleXfs. The current code:

internal CT_Xf GetCellStyleXfAt(int idx)
{
    if (idx < 0 || idx > styleXfs.Count)
        return null;
    return styleXfs[idx];
}

fails when styleXfs is empty because it checks idx > styleXfs.Count instead of idx >= styleXfs.Count.
I will create a PR with the fix and test case.

Kind regards,
Artur

aboryczko pushed a commit to aboryczko/npoi that referenced this issue Jul 23, 2022
tonyqus added a commit that referenced this issue Jul 23, 2022
@tonyqus tonyqus closed this as completed Jul 23, 2022
@tonyqus tonyqus added this to the NPOI 2.6.0 milestone Jul 23, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants