-
-
Notifications
You must be signed in to change notification settings - Fork 593
Open
Description
QString DeepSeekWidgetUI::convertMarkdownToHtml(const QString& markdown)
{
QByteArray byteArray = markdown.toUtf8();
const char* markdownCString = byteArray.constData();
char* html = cmark_markdown_to_html(markdownCString, strlen(markdownCString), CMARK_OPT_DEFAULT);
if (html == NULL)
{
return markdown;
}
QString htmlText = QString::fromUtf8(html);
free(html);
return htmlText;
}
After calling the cmark_markdown_to_html function, I copied the data to the QString, then released the memory and crashed directly. I thought it was a problem with the QString::fromUtf8() function, so I tested it and executed free() before QString::fromUtf8(), and it crashed as well.
This is the result of the call after QString::fromUtf8()
This is the result of the call before QString::fromUtf8()
Metadata
Metadata
Assignees
Labels
No labels