Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

sourceElement can become NULL in function clickHandler #814

Closed
mgc8 opened this Issue · 2 comments

2 participants

@mgc8

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

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

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

@mgc8 mgc8 added this to the Piwik 0.4.1 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.