Skip to content

[UWP] GenerateElementProjection() performs risky cast in default case #6394

@paulcam206

Description

@paulcam206

case CardElementType::Unknown:
default:
return winrt::make<winrt::AdaptiveCards::ObjectModel::Uwp::implementation::AdaptiveUnsupportedElement>(
std::AdaptivePointerCast<AdaptiveCards::UnknownElement>(baseElement));
}

In the above, if we encounter an element that isn't covered in a case, but is a known element (shouldn't happen, but see #6393), we can end up incorrectly casting a known element to AdaptiveCards::UnknownElement, leading to undefined behavior later on. We should probably split the default case out on its own and throw an exception (and do a quick examination to see if this pattern is repeated elsewhere).

Metadata

Metadata

Assignees

Labels

Platform-XAMLBugs or features related to Xaml Renderer

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions