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

[assert] can't send message including ASCII escape (used by ASCII coloring) #900

Open
mizhka opened this issue Feb 19, 2024 · 5 comments
Open
Assignees
Labels
crash A crash occurs in Quaternion code invalid There's nothing to improve in Quaternion

Comments

@mizhka
Copy link

mizhka commented Feb 19, 2024

Description

Quaternion crashes on send of "bad message"
quaternion-html-crash.txt

Steps to reproduce

Actual problem symbol is ASCII '1b'

Quaternion logs:

quaternion.htmlfilter: Invalid XHTML: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\np, li { white-space: pre-wrap; }\n</style></head><body style=\" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;\">\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Вопрос - почему в тестах у нас аш 40 секунд разницы между взятием test_start и запуском самого теста?</p>\n<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">TASK [Set test start time] *****************************************************</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Saturday 17 February 2024  09:11:27 +0300 (0:00:01.535)       0:00:04.174 ***** </p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;32mok: [loadgenerator0] =&gt; changed=false \u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;32m  ansible_facts:\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;32m    test_start: '1708150287'\u001B[0m</p>\n<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">...</p>\n<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">TASK [Run test] ****************************************************************</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Saturday 17 February 2024  09:12:11 +0300 (0:00:00.013)       0:00:47.308 ***** </p>\n<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  delta: '0:04:55.459249'\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  end: '2024-02-17 06:17:10.497128'\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  finished: 1\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  msg: ''\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  rc: 0\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  results_file: /home/pgpro/.ansible_async/408805503324.39301\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  start: '2024-02-17 06:12:15.037879'\u001B[0m</p></body></html>"
quaternion.htmlfilter: Error at char 907: "Unexpected ''."
quaternion.htmlfilter: Buffer at error: "[0;32mok: [loadgenerator0] =&gt; changed=false \u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;32m  ansible_facts:\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;32m    test_start: '1708150287'\u001B[0m</p>\n<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">...</p>\n<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">TASK [Run test] ****************************************************************</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Saturday 17 February 2024  09:12:11 +0300 (0:00:00.013)       0:00:47.308 ***** </p>\n<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  delta: '0:04:55.459249'\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  end: '2024-02-17 06:17:10.497128'\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  finished: 1\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  msg: ''\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  rc: 0\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  results_file: /home/pgpro/.ansible_async/408805503324.39301\u001B[0m</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">\u001B[0;33m  start: '2024-02-17 06:12:15.037879'\u001B[0m</p></body></html>", 2515 character(s) remaining
ASSERT: "result.errorPos == -1" in file /usr/ports/net-im/quaternion/work/Quaternion-6103f98e2ac56ebb88f3393cdc9801ed0dd277d4/client/htmlfilter.cpp, line 356
zsh: abort (core dumped)  /usr/ports/net-im/quaternion/work/stage/usr/local/bin/quaternion

Backtrace:


* thread #1, name = 'quaternion', stop reason = signal SIGABRT
  * frame #0: 0x0000000830b62f5a libc.so.7`__sys_thr_kill at thr_kill.S:4
    frame #1: 0x0000000830adb7c4 libc.so.7`__raise(s=6) at raise.c:50:10
    frame #2: 0x0000000830b8dc39 libc.so.7`abort at abort.c:65:8
    frame #3: 0x000000082e869dfc libQt5Core.so.5`QMessageLogger::fatal(char const*, ...) const + 206
    frame #4: 0x000000082e862597 libQt5Core.so.5`qt_assert(char const*, char const*, int) + 68
    frame #5: 0x00000000002b61f6 quaternion`HtmlFilter::toMatrixHtml(qtMarkup=0x00000008205acdb8, context=<unavailable>, options=(i = 0)) at htmlfilter.cpp:356:5
    frame #6: 0x00000000002fb35b quaternion`ChatRoomWidget::sendMessage(this=0x00001442e0bc4100) at chatroomwidget.cpp:449:9
    frame #7: 0x00000000002f8700 quaternion`ChatRoomWidget::sendInput(this=0x00001442e0bc4100) at chatroomwidget.cpp:729:13
    frame #8: 0x000000082ea5798a libQt5Core.so.5`___lldb_unnamed_symbol9679 + 1066
    frame #9: 0x00000008290d3181 libQt5Widgets.so.5`QWidget::event(QEvent*) + 593
    frame #10: 0x000000082916fb5b libQt5Widgets.so.5`QFrame::event(QEvent*) + 43
    frame #11: 0x0000000829252d6c libQt5Widgets.so.5`QTextEdit::event(QEvent*) + 428
    frame #12: 0x0000000829099af3 libQt5Widgets.so.5`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 259
    frame #13: 0x000000082909b0bd libQt5Widgets.so.5`QApplication::notify(QObject*, QEvent*) + 1069
    frame #14: 0x000000082ea24111 libQt5Core.so.5`QCoreApplication::notifyInternal2(QObject*, QEvent*) + 177
    frame #15: 0x00000008290ef1f2 libQt5Widgets.so.5`___lldb_unnamed_symbol14079 + 290
    frame #16: 0x0000000829099af3 libQt5Widgets.so.5`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 259
    frame #17: 0x000000082909ae9e libQt5Widgets.so.5`QApplication::notify(QObject*, QEvent*) + 526
    frame #18: 0x000000082ea24111 libQt5Core.so.5`QCoreApplication::notifyInternal2(QObject*, QEvent*) + 177
    frame #19: 0x000000082b4bf5d5 libQt5Gui.so.5`QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) + 245
    frame #20: 0x000000082b4a2c4b libQt5Gui.so.5`QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 219
    frame #21: 0x000000084d2d1b8f libQt5XcbQpa.so.5`___lldb_unnamed_symbol3548 + 31

Version information

  • Quaternion version: 0.0.96
  • Qt version: Qt 5
  • Install method: manually compiled
  • Platform: FreeBSD 15-CURRENT (master)
@KitsuneRal KitsuneRal added the crash A crash occurs in Quaternion code label Feb 19, 2024
@KitsuneRal KitsuneRal self-assigned this Feb 19, 2024
@KitsuneRal
Copy link
Member

This turned out to be more interesting than I thought. https://www.w3.org/International/questions/qa-controls says that (most) control characters are invalid in the context of HTML 4, and can only be represented as &#-sequences in XML 1.1; however, Qt's own QTextDocument happily exports text without (at least) turning \x1b characters to &#27. Seems like incompliance on Qt side.

@KitsuneRal KitsuneRal added the bug/fix Quaternion doesn't work as expected label Feb 19, 2024
@KitsuneRal
Copy link
Member

Also, ftr: the crash is actually an assertion failure; if you build in Release configuration, you just won't be able to send a message with control characters, so it's not too grave.

@KitsuneRal
Copy link
Member

https://bugreports.qt.io/browse/QTBUG-122466 - let's see where it takes us.

@KitsuneRal KitsuneRal added invalid There's nothing to improve in Quaternion and removed bug/fix Quaternion doesn't work as expected labels Feb 19, 2024
@mizhka mizhka changed the title [crash] can't send message including ASCII escape (used by ASCII coloring) [assert] can't send message including ASCII escape (used by ASCII coloring) Feb 21, 2024
@mizhka
Copy link
Author

mizhka commented Feb 21, 2024

@KitsuneRal : title has been corrected (crash->assert).
QT bug: fingers crossed, but do you plan any action in addition?

@quotient-im quotient-im deleted a comment from Arkansasburk27 Mar 8, 2024
@KitsuneRal
Copy link
Member

I can try to insert some workaround, perhaps... I already have a few, anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash A crash occurs in Quaternion code invalid There's nothing to improve in Quaternion
Projects
Status: 0.0.97 - To Do
Development

No branches or pull requests

2 participants