Bug 376419 - Template angle brackets not HTML-escaped in tooltips for clang errors
Summary: Template angle brackets not HTML-escaped in tooltips for clang errors
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (other bugs)
Version First Reported In: git master
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-12 22:29 UTC by Nicolás Alvarez
Modified: 2017-02-22 08:59 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In: 5.1.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolás Alvarez 2017-02-12 22:29:52 UTC
If my C++ code has an error detected by clang parsing, and the error message includes a type with template parameters, the parameters were missing; for example saying "no conversion from 'std::unique_ptr' to 'pointer'" but not including the type passed to unique_ptr.

Since the tooltip uses HTML-based rich text formatting, I suspected it could be because the angle brackets are not escaped, and sure enough that was exactly the problem. Here is a test case:

template<typename T>
class SmartPtr {};

class u{};

void foo(int);
void bar() {
    SmartPtr<u> ptr;
    foo(ptr);
}

Clang will complain that 'SmartPtr<u>' cannot be converted to 'int' when calling 'foo', but since the message is not escaped, <u> will be interpreted as the 'underline' HTML tag, it won't be visible as text, and the tooltip contents after that will appear underlined.
Comment 1 Milian Wolff 2017-02-21 22:59:44 UTC
Git commit 2d04564d564cc1332c9006f47c93e3912c149c65 by Milian Wolff.
Committed on 21/02/2017 at 22:58.
Pushed by mwolff into branch '5.1'.

HTML-escape diagnostic description before showing it in a tooltip

The tooltip displays rich-text, and thus we have to escape contents
before displaying them. This was done already for the main problem's
description, but was missed so far for the sub-diagnostics.

M  +1    -1    language/duchain/navigation/problemnavigationcontext.cpp

https://commits.kde.org/kdevplatform/2d04564d564cc1332c9006f47c93e3912c149c65