Skip to content

Commit 70d239f

Browse files
Merge pull request #106 from developer0hye/ralph/phase23-triage-upstream-issues
test: add fixture tests for upstream parse failures
2 parents 954885e + de50315 commit 70d239f

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

crates/office2pdf/tests/docx_fixtures.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,5 +653,8 @@ docx_fixture_tests!(tdf171038_page_after, "libreoffice/tdf171038_pageAfter.docx"
653653
// Intentionally malformed XML — clean parse error (not panic)
654654
docx_fixture_tests!(math_malformed_xml, "libreoffice/math-malformed_xml.docx");
655655

656+
// XML external entity references — docx-rs correctly rejects for security
657+
docx_fixture_tests!(external_entity_in_text, "poi/ExternalEntityInText.docx");
658+
656659
// Deeply nested tables (5000+ levels) — clean error after depth-limit fix (not stack overflow)
657660
docx_fixture_tests!(deep_table_cell, "poi/deep-table-cell.docx");

crates/office2pdf/tests/xlsx_fixtures.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,47 @@ xlsx_fixture_tests!(
382382
"SH108-SimpleFormattedCell.xlsx"
383383
);
384384

385+
// --- Upstream parse failures (umya-spreadsheet) ------------------------------
386+
// Related: #97
387+
// These files fail with parse errors in umya-spreadsheet. All are handled
388+
// gracefully — no panics, no crashes. Documented as known upstream limitations.
389+
390+
// ZipError: specified file not found in archive
391+
xlsx_fixture_tests!(tdf121887, "libreoffice/tdf121887.xlsx");
392+
xlsx_fixture_tests!(tdf131575, "libreoffice/tdf131575.xlsx");
393+
xlsx_fixture_tests!(tdf76115, "libreoffice/tdf76115.xlsx");
394+
xlsx_fixture_tests!(poi_49609, "poi/49609.xlsx");
395+
xlsx_fixture_tests!(poi_56278, "poi/56278.xlsx");
396+
xlsx_fixture_tests!(poi_59021, "poi/59021.xlsx");
397+
398+
// IoError: Invalid checksum
399+
xlsx_fixture_tests!(forcepoint107, "libreoffice/forcepoint107.xlsx");
400+
401+
// ZipError: invalid Zip archive (Could not find EOCD)
402+
xlsx_fixture_tests!(deep_data, "poi/deep-data.xlsx");
403+
404+
// --- Upstream panics caught by catch_unwind (umya-spreadsheet) ----------------
405+
// Related: #97
406+
// These files trigger panics inside umya-spreadsheet (arithmetic overflow,
407+
// unwrap on None). catch_unwind prevents process crashes. Documented as
408+
// known upstream limitations.
409+
410+
// attempt to subtract with overflow
411+
xlsx_fixture_tests!(
412+
functions_excel_2010,
413+
"libreoffice/functions-excel-2010.xlsx"
414+
);
415+
xlsx_fixture_tests!(poi_51710, "poi/51710.xlsx");
416+
417+
// called Option::unwrap() on a None value
418+
xlsx_fixture_tests!(poi_64450, "poi/64450.xlsx");
419+
420+
// attempt to multiply with overflow
421+
xlsx_fixture_tests!(
422+
formula_eval_test_data_copy,
423+
"poi/FormulaEvalTestData_Copy.xlsx"
424+
);
425+
385426
// --- Upstream panic safety (patched umya-spreadsheet) ------------------------
386427
// Related: #83
387428

0 commit comments

Comments
 (0)