Language: JavaScript
Label: safe
CWE: CWE-400 \u2014 Uncontrolled Resource Consumption
The product does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.

Code:
Graph.prototype.createLayouts = function(list)
{
	var layouts = [];

	for (var i = 0; i < list.length; i++)
	{
		if (mxUtils.indexOf(Graph.layoutNames, list[i].layout) >= 0)
		{
			var layout = new window[list[i].layout](this);
			
			if (list[i].config != null)
			{
				for (var key in list[i].config)
				{
					layout[key] = list[i].config[key];
				}
			}

			layouts.push(layout);
		}
		else
		{
			throw Error(mxResources.get('invalidCallFnNotFound', [list[i].layout]));
		}
	}

	return layouts;
};