Type confusion with <picture> and <source> elements
- Fixed in 39 hours
- Paid in 6 days
- Disclosed after 39 hours
Created attachment 8565873
testcase
The following code in HTMLImageElement::TryCreateResponsiveSelector is vulnerable to a type confusion issue:
bool isSourceTag = aSourceNode->Tag() == nsGkAtoms::source;
if (isSourceTag) {
DebugOnly<nsINode *> parent(nsINode::GetParentNode());
MOZ_ASSERT(parent && parent->Tag() == nsGkAtoms::picture);
MOZ_ASSERT(IsPreviousSibling(aSourceNode, this));
MOZ_ASSERT(pictureEnabled);
// Check media and type
HTMLSourceElement *src = static_cast<HTMLSourceElement*>(aSourceNode);
if (!src->MatchesCurrentMedia()) {
return false;
}
The code only checks whether aSourceNode has the tag name "source" without validating the namespace. The attached testcase demonstrates the issues.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A critical-severity memory corruption bug in DOM: Core & HTML. Mozilla made it public on 20 February 2015.
About Memory corruption
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.