Commit 3b790fb
authored
Fix OOXML schema validity, correctness, perf, and security issues (#30)
Correctness:
- Tables: derive column count from the rowspan grid so cells in later,
wider rows are no longer silently dropped
- Tables: thread FootnoteIndex/BookmarkId through per-cell contexts and
seed FootnoteIndex from the existing part, so footnote and bookmark IDs
no longer collide across cells or across Build calls
- Emit w:rPr and w:tcPr children in OOXML schema order; previously the
output was schema-invalid and only tolerated by Word
- Cell margins emit w:left/w:right instead of the invalid w:start/w:end
- ColorParser: accept percentage and decimal rgb()/rgba() components
- vertical-align is matched case-insensitively
- word-spacing no longer doubles letter-spacing
- @page: match the closing brace and skip nested margin-box rules so
sibling declarations (margin/size) are not lost
Performance:
- Parse each element's inline style once instead of twice
- Allocate list numbering IDs from the threaded NextNumId counter rather
than rescanning the numbering part per list (O(m^2) -> O(m))
- Compute ordered-list item indices in a single pass (O(n^2) -> O(n))
Security:
- Image fetch: disable auto-redirect and re-check each redirect hop
against the image policy (closes a SafeDomains/SSRF bypass), cap the
response size, set a timeout, and parse width/height with
InvariantCulture
Tests:
- Add rowspan, footnote-id, bookmark-id, and OpenXmlValidator round-trip
tests, plus rgb() percentage cases
- Regenerate affected verified baselines (structural reordering only;
rendered text/image output unchanged)1 parent 580b4d3 commit 3b790fb
72 files changed
Lines changed: 563 additions & 158 deletions
File tree
- src
- OpenXmlHtml.Tests
- Samples
- OpenXmlHtml
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
0 commit comments