Merge pull request #2624 from gingerik/wkt-call-stack

Fix potentially exceeding call stack limit
This commit is contained in:
Éric Lemoine
2014-08-26 08:57:31 +02:00
+8 -8
View File
@@ -761,8 +761,8 @@ ol.format.WKT.Parser.prototype.parsePoint_ = function() {
*/ */
ol.format.WKT.Parser.prototype.parsePointList_ = function() { ol.format.WKT.Parser.prototype.parsePointList_ = function() {
var coordinates = [this.parsePoint_()]; var coordinates = [this.parsePoint_()];
if (this.match(ol.format.WKT.TokenType.COMMA)) { while (this.match(ol.format.WKT.TokenType.COMMA)) {
goog.array.extend(coordinates, this.parsePointList_()); coordinates.push(this.parsePoint_());
} }
return coordinates; return coordinates;
}; };
@@ -774,8 +774,8 @@ ol.format.WKT.Parser.prototype.parsePointList_ = function() {
*/ */
ol.format.WKT.Parser.prototype.parsePointTextList_ = function() { ol.format.WKT.Parser.prototype.parsePointTextList_ = function() {
var coordinates = [this.parsePointText_()]; var coordinates = [this.parsePointText_()];
if (this.match(ol.format.WKT.TokenType.COMMA)) { while (this.match(ol.format.WKT.TokenType.COMMA)) {
goog.array.extend(coordinates, this.parsePointTextList_()); coordinates.push(this.parsePointText_());
} }
return coordinates; return coordinates;
}; };
@@ -787,8 +787,8 @@ ol.format.WKT.Parser.prototype.parsePointTextList_ = function() {
*/ */
ol.format.WKT.Parser.prototype.parseLineStringTextList_ = function() { ol.format.WKT.Parser.prototype.parseLineStringTextList_ = function() {
var coordinates = [this.parseLineStringText_()]; var coordinates = [this.parseLineStringText_()];
if (this.match(ol.format.WKT.TokenType.COMMA)) { while (this.match(ol.format.WKT.TokenType.COMMA)) {
goog.array.extend(coordinates, this.parseLineStringTextList_()); coordinates.push(this.parseLineStringText_());
} }
return coordinates; return coordinates;
}; };
@@ -800,8 +800,8 @@ ol.format.WKT.Parser.prototype.parseLineStringTextList_ = function() {
*/ */
ol.format.WKT.Parser.prototype.parsePolygonTextList_ = function() { ol.format.WKT.Parser.prototype.parsePolygonTextList_ = function() {
var coordinates = [this.parsePolygonText_()]; var coordinates = [this.parsePolygonText_()];
if (this.match(ol.format.WKT.TokenType.COMMA)) { while (this.match(ol.format.WKT.TokenType.COMMA)) {
goog.array.extend(coordinates, this.parsePolygonTextList_()); coordinates.push(this.parsePolygonText_());
} }
return coordinates; return coordinates;
}; };