-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix numeric and named entity validation
We now escape entities that we're sure aren't valid, or don't match a whitelist of named entities (if applicable.)
- Loading branch information
1 parent
4894747
commit c96c9f5
Showing
5 changed files
with
300 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
build/ | ||
snudown.egg-info/ | ||
src/html_entities.h | ||
*.pyc | ||
*.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,239 @@ | ||
%language=ANSI-C | ||
%define lookup-function-name is_allowed_named_entity | ||
%compare-strncmp | ||
%readonly-tables | ||
%define hash-function-name hash_html_entity | ||
%enum | ||
%includes | ||
%{ | ||
#include <stdlib.h> | ||
|
||
// Parsers tend to choke on entities with values greater than this | ||
const u_int32_t MAX_NUM_ENTITY_VAL = 0x10ffff; | ||
// Any numeric entity longer than this is obviously above MAX_ENTITY_CHAR | ||
// used to avoid dealing with overflows. | ||
const size_t MAX_NUM_ENTITY_LEN = 7; | ||
%} | ||
%% | ||
Æ | ||
Á | ||
 | ||
À | ||
Α | ||
Å | ||
à | ||
Ä | ||
Β | ||
Ç | ||
Χ | ||
‡ | ||
Δ | ||
Ð | ||
É | ||
Ê | ||
È | ||
Ε | ||
Η | ||
Ë | ||
Γ | ||
Í | ||
Î | ||
Ì | ||
Ι | ||
Ï | ||
Κ | ||
Λ | ||
Μ | ||
Ñ | ||
Ν | ||
Œ | ||
Ó | ||
Ô | ||
Ò | ||
Ω | ||
Ο | ||
Ø | ||
Õ | ||
Ö | ||
Φ | ||
Π | ||
″ | ||
Ψ | ||
Ρ | ||
Š | ||
Σ | ||
Þ | ||
Τ | ||
Θ | ||
Ú | ||
Û | ||
Ù | ||
Υ | ||
Ü | ||
Ξ | ||
Ý | ||
Ÿ | ||
Ζ | ||
á | ||
â | ||
´ | ||
æ | ||
à | ||
ℵ | ||
α | ||
& | ||
∧ | ||
∠ | ||
' | ||
å | ||
≈ | ||
ã | ||
ä | ||
„ | ||
β | ||
¦ | ||
• | ||
∩ | ||
ç | ||
¸ | ||
¢ | ||
χ | ||
ˆ | ||
♣ | ||
≅ | ||
© | ||
↵ | ||
∪ | ||
¤ | ||
⇓ | ||
† | ||
↓ | ||
° | ||
δ | ||
♦ | ||
÷ | ||
∞ | ||
∫ | ||
ι | ||
¿ | ||
∈ | ||
ï | ||
κ | ||
⇐ | ||
λ | ||
⟨ | ||
« | ||
← | ||
⌈ | ||
“ | ||
≤ | ||
⌊ | ||
∗ | ||
◊ | ||
‎ | ||
‹ | ||
‘ | ||
< | ||
¯ | ||
— | ||
µ | ||
· | ||
− | ||
μ | ||
∇ | ||
| ||
– | ||
≠ | ||
∋ | ||
¬ | ||
∉ | ||
⊄ | ||
ñ | ||
ν | ||
ó | ||
ô | ||
œ | ||
ò | ||
‾ | ||
ω | ||
ο | ||
⊕ | ||
∨ | ||
ª | ||
º | ||
ø | ||
õ | ||
⊗ | ||
ö | ||
¶ | ||
∂ | ||
‰ | ||
⊥ | ||
φ | ||
π | ||
ϖ | ||
± | ||
£ | ||
′ | ||
∏ | ||
∝ | ||
ψ | ||
" | ||
⇒ | ||
√ | ||
⟩ | ||
» | ||
→ | ||
⌉ | ||
” | ||
ℜ | ||
® | ||
⌋ | ||
ρ | ||
‏ | ||
› | ||
’ | ||
‚ | ||
š | ||
⋅ | ||
§ | ||
­ | ||
σ | ||
ς | ||
∼ | ||
♠ | ||
⊂ | ||
⊆ | ||
∑ | ||
¹ | ||
² | ||
³ | ||
⊃ | ||
⊇ | ||
ß | ||
τ | ||
∴ | ||
θ | ||
ϑ | ||
  | ||
þ | ||
˜ | ||
× | ||
™ | ||
⇑ | ||
ú | ||
↑ | ||
û | ||
ù | ||
¨ | ||
ϒ | ||
υ | ||
ü | ||
℘ | ||
ξ | ||
ý | ||
¥ | ||
ÿ | ||
ζ | ||
‍ | ||
‌ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters