labadserver / Adplayer

Adplayer reference implementation
https://github.com/labadserver/Adplayer/wiki
Other
28 stars 11 forks source link

Safe iteration for collectPrivacy #136

Closed andreasberenz closed 12 years ago

andreasberenz commented 12 years ago

A customer of ours delivered the Adplayer on a website, where array.prototype.toJSON was implemented.

In $ADP.Registry.collectPrivacy this.data is iterated through as follows:

for (var i in this.data) { if (this.data[i].property) ... }

The first iteration: i=0, the last iteration: i="toJSON" and the program runs into an error because this.data["toJSON"] is not available.

To avoid this situation we should ensure, that the program does not crash at every "var i in j"-loop.