Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes various infinite loops on heavily nested plists, fixes a logic bug

in nested array/dict handling that lead to incorrect nesting.

Signed-off-by: Jeremy Johnstone <github@jeremyjohnstone.com>
  • Loading branch information...
commit 0371782ca8aef1152baddca57808c98e84a91ecc 1 parent f01a65a
@Jonty Jonty authored committed
Showing with 4 additions and 5 deletions.
  1. +4 −5 classes/parsers/plist/PlistParser.inc
View
9 classes/parsers/plist/PlistParser.inc
@@ -106,19 +106,18 @@ class plistParser extends XMLReader
$this->nextOfType(XMLReader::ELEMENT);
$array[$key] = $this->parse_node();
$this->nextOfType(XMLReader::ELEMENT, XMLReader::END_ELEMENT);
- } while(!$this->isNodeOfTypeName(XMLReader::END_ELEMENT, "dict"));
+ } while($this->nodeType && !$this->isNodeOfTypeName(XMLReader::END_ELEMENT, "dict"));
return $array;
}
private function parse_array() {
$array = array();
+ $this->nextOfType(XMLReader::ELEMENT);
do {
- // find the first item of the array and append it onto the node list
- $this->nextOfType(XMLReader::ELEMENT);
$array[] = $this->parse_node();
// skip over any whitespace
$this->nextOfType(XMLReader::ELEMENT, XMLReader::END_ELEMENT);
- } while(!$this->isNodeOfTypeName(XMLReader::END_ELEMENT, "array"));
+ } while($this->nodeType && !$this->isNodeOfTypeName(XMLReader::END_ELEMENT, "array"));
return $array;
}
@@ -134,7 +133,7 @@ class plistParser extends XMLReader
// skip to next
$this->read();
// check if it's one of the types requested and loop until it's one we want
- while(!(in_array($this->nodeType, $types))) {
+ while($this->nodeType && !(in_array($this->nodeType, $types))) {
// node isn't of type requested, so keep going
$this->read();
}
Please sign in to comment.
Something went wrong with that request. Please try again.