mirror of https://github.com/adamdruppe/arsd.git
yet more range violation checks to handle pure garbage
This commit is contained in:
parent
e263a128ab
commit
e44b740688
12
dom.d
12
dom.d
|
@ -3467,6 +3467,12 @@ class Document : FileResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
string readAttributeValue() {
|
string readAttributeValue() {
|
||||||
|
if(pos >= data.length) {
|
||||||
|
if(strict)
|
||||||
|
throw new Exception("no attribute value before end of file");
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
switch(data[pos]) {
|
switch(data[pos]) {
|
||||||
case '\'':
|
case '\'':
|
||||||
case '"':
|
case '"':
|
||||||
|
@ -3810,6 +3816,10 @@ class Document : FileResource {
|
||||||
moreAttributes:
|
moreAttributes:
|
||||||
eatWhitespace();
|
eatWhitespace();
|
||||||
|
|
||||||
|
// same deal as above the switch....
|
||||||
|
if(!strict && pos >= data.length)
|
||||||
|
return addTag(false);
|
||||||
|
|
||||||
switch(data[pos]) {
|
switch(data[pos]) {
|
||||||
case '/': // self closing tag
|
case '/': // self closing tag
|
||||||
return addTag(true);
|
return addTag(true);
|
||||||
|
@ -3839,7 +3849,7 @@ class Document : FileResource {
|
||||||
attributes[attrName] = attrValue;
|
attributes[attrName] = attrValue;
|
||||||
else if(strict) throw new MarkupException("wtf, zero length attribute name");
|
else if(strict) throw new MarkupException("wtf, zero length attribute name");
|
||||||
|
|
||||||
if(!strict && data[pos] == '<') {
|
if(!strict && pos < data.length && data[pos] == '<') {
|
||||||
// this is the broken tag that doesn't have a > at the end
|
// this is the broken tag that doesn't have a > at the end
|
||||||
// let's insert one as a hack
|
// let's insert one as a hack
|
||||||
goto case '>';
|
goto case '>';
|
||||||
|
|
Loading…
Reference in New Issue