File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1717
1818### Bug Fixes
1919
20+ - [ #781 ] : Fix conditions to start CDATA section. Only uppercase ` <![CDATA[ ` can start it.
21+ Previously any case was allowed.
22+
2023### Misc Changes
2124
25+ [ #781 ] : https://github.com/tafia/quick-xml/pull/781
26+
2227
2328## 0.35.0 -- 2024-06-29
2429
Original file line number Diff line number Diff line change @@ -128,14 +128,22 @@ impl ReaderState {
128128 self . decoder ( ) ,
129129 ) ) )
130130 }
131- BangType :: CData if uncased_starts_with ( buf, b"![CDATA[" ) => {
131+ // XML requires uppercase only:
132+ // https://www.w3.org/TR/xml11/#sec-cdata-sect
133+ // Even HTML5 required uppercase only:
134+ // https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state
135+ BangType :: CData if buf. starts_with ( b"![CDATA[" ) => {
132136 debug_assert ! ( buf. ends_with( b"]]" ) ) ;
133137 Ok ( Event :: CData ( BytesCData :: wrap (
134138 // Cut of `![CDATA[` and `]]` from start and end
135139 & buf[ 8 ..len - 2 ] ,
136140 self . decoder ( ) ,
137141 ) ) )
138142 }
143+ // XML requires uppercase only, but we will check that on validation stage:
144+ // https://www.w3.org/TR/xml11/#sec-prolog-dtd
145+ // HTML5 allows mixed case for doctype declarations:
146+ // https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state
139147 BangType :: DocType if uncased_starts_with ( buf, b"!DOCTYPE" ) => {
140148 match buf[ 8 ..] . iter ( ) . position ( |& b| !is_whitespace ( b) ) {
141149 Some ( start) => Ok ( Event :: DocType ( BytesText :: wrap (
You can’t perform that action at this time.
0 commit comments