Skip to content

Infinite loop on a malformed .xls whose declared stream size exceeds its block chain #1844

Description

@pawlos

NPOI Version

2.8.0 latest nuget; reproduced on main

File Type

  • XLSX
  • XLS
  • DOCX
  • XLSM
  • OTHER

Upload the Excel File

hang_readfully.zip

Reproduce Steps

using NPOI.SS.UserModel;

using var fs = File.OpenRead("hang_readfully.xls");
var wb = WorkbookFactory.Create(fs);

Issue Description

A malformed .xls (OLE2 compound file) passed to WorkbookFactory.Create(Stream) can put NPOI into an unterminating loop that pins a CPU core indefinitely. The loop never returns, so a caller cannot recover by catching an exception - the only options are to abandon the thread or kill the process.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions