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

NodeTreeBase: Fix HTML href attribute parsing #1237

Merged
merged 1 commit into from Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/dbtree/nodetreebase.cpp
Expand Up @@ -2160,8 +2160,13 @@ void NodeTreeBase::parse_html( const char* str, std::size_t lng_str, const int c
create_node_ntext( m_parsed_text.data(), m_parsed_text.size(), fgcolor, bgcolor, in_bold, fontid );
m_parsed_text.clear();

while( pos < pos_end && *pos != '=' ) ++pos;
++pos;
for( bool found = false; ! found; ) {
while( pos < pos_end && *pos != '=' ) ++pos;
// NOTE: 速度を重視するためhrefの判定は最後のfだけチェック
// `<a>`タグに含まれる'='、global属性、data属性で誤判定する可能性がある
found = ( pos[-1] == 'f' || pos[-1] == 'F' || pos >= pos_end );
++pos;
}

if( *pos == ' ' ) ++pos;
if( pos >= pos_end ) continue;
Expand Down