Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sourceElement can become NULL in function clickHandler #814

Closed
mgc8 opened this issue Jun 19, 2009 · 2 comments
Closed

sourceElement can become NULL in function clickHandler #814

mgc8 opened this issue Jun 19, 2009 · 2 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@mgc8
Copy link

mgc8 commented Jun 19, 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
Copy link
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
Copy link
Contributor

(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 Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

2 participants