@mgc8 opened this Issue on June 19th 2009

In the function clickHandler(clickEvent) at line 661 in piwik.js, the while loop executes

sourceElement = sourceElement.parentNode;

without checking sourceElement.parentNode. This can lead to sourceElement becoming NULL and errors in the following code.

A patch is simple enough:

--while ((tag = sourceElement.tagName) != 'A' && tag != 'AREA') {
++while ((sourceElement.parentNode) && ((tag = sourceElement.tagName) != 'A' && tag != 'AREA')) {

Thanks,
Mihnea
Keywords: clickHandler, sourceElement, null

@robocoder commented on June 19th 2009 Contributor

True, but we attach the click handler using the anchor tags returned by document.links. So, the only time we could enter the loop is when the web site did something silly, i.e.,

tracker->addListener(clickable_non_anchor_element_with_no_anchor_element_ancestors).

@robocoder commented on June 19th 2009 Contributor

(In [1243]) Fixes #814 - guard against:
addListener(clickable_non_anchor_element_with_no_anchor_element_ancestors)

This Issue was closed on June 19th 2009
Powered by GitHub Issue Mirror