Closed Mi-La closed 3 years ago
I think I've the problem. In librocketchat.c:1380
, there is a call to rc_markdown_to_html
and the msg_text
argument is NULL. The rc_markdown_to_html
uses strlen
on that NULL argument here: librocketchat.c:388
.
Note that strlen
doesn't check for NULL and causes SEGFAULT. I did a quick hack to prevent crash by changing the line 388 from:
markdown_len = mkd_line((char *)markdown, strlen(markdown), &markdown_str, flags);
to:
markdown_len = mkd_line((char *)markdown, markdown != NULL ? strlen(markdown) : 0, &markdown_str, flags);
At least it doesn't crash anymore and the message displays correctly in a new "room-like" window.
Should I create a pull request with the one-liner hot fix? :-).
Sorry, received your bug report while I was on holiday and put it on the backburner
Rather than doing stuff inline, would it be better to return NULL
from rc_markdown_to_html
if the input is also NULL
so that it doesn't need to go through the libdiscount calls unnecessairly?
If you have time to do it properly, please just fix it. I don't need to have my own pull request merged ;-). I was happy enough to temporarily fix the crash and report the issue.
FYI: There are more problems with rooms, e.g. after pidgin restart, I don't get new messages from "rooms"/discussions (even though I have auto join
and persistent
options checked) . But sometimes the messages suddenly arrive, I think that it happens when some user who is in the room changes his status.
Fair enough, wasn't about who gets credit for what, but you're more able to recreate the issue so more able to confirm a fix :)
Can you try with the above commit and see if that helps?
Fix verified, works well. Thanks.
I'll try to investigate the FYI part of my last comment when I have more time.
Awesome, thanks for confirming :)
Appreciate the issue reports :)
Using latest master, the plugin causes whole Pidgin crash since somebody use "Start a Discussion". Please see the attached backtrace.
pidgin-backtrace.log
When running the pidgin via gdb, it seems that a new window for the discussion is created with some random name - e.g. "RvwHoPGXuTbA3dxsj" .... but than the SIGSEGV appears.