Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 2 additions & 5 deletions src/cfb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,9 @@ impl Sectors {
r: &mut R,
len: usize,
) -> Result<Vec<u8>, CfbError> {
let mut chain = if len > 0 {
Vec::with_capacity(len)
} else {
Vec::new()
};
let mut chain = Vec::with_capacity(len);
while sector_id != ENDOFCHAIN {
// FIXME: see tests/OOM_alloc3.xls, this call OOMs
chain.extend_from_slice(self.get(sector_id, r)?);
sector_id = fats[sector_id as usize];
}
Expand Down
Binary file added tests/OOM_alloc3.xls
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2148,4 +2148,7 @@ fn test_oom_allocation() {
let ws = xls.worksheets();
assert_eq!(ws.len(), 1);
assert_eq!(ws[0].0, "Colsale (Aug".to_string());

// FIXME: kills all tests with abort unless unstable set_alloc_error_hook is used
// let _xls: Xls<_> = wb("OOM_alloc3.xls");
}
Loading