baedert / corebird

Native Gtk+ Twitter Client
https://corebird.baedert.org
GNU General Public License v3.0
789 stars 78 forks source link

Replies branch gets SIGTRAP in [situation TBC] #706

Closed IBBoard closed 7 years ago

IBBoard commented 7 years ago

While testing the Replies branch I triggered a crash.

Steps to create:

  1. Find Eevee's tweet that quotes a message that has replies (https://twitter.com/eevee/status/853951457531277312)
  2. Double-click on Eevee's message
  3. Click on the link to the quoted tweet
  4. Corebird crashes with:

    (corebird:11796): GLib-ERROR **: gmem.c:100: failed to allocate 18446744073709551600 bytes Trace/breakpoint trap (core dumped)

From a bit of poking, it appears to be an issue with a reply to that tweet:

bt no-filters 5
#0  0x00007ffff372e713 in g_logv () from /usr/lib64/libglib-2.0.so.0
#1  0x00007ffff372e882 in g_log () from /usr/lib64/libglib-2.0.so.0
#2  0x00007ffff372d454 in g_malloc () from /usr/lib64/libglib-2.0.so.0
#3  0x00007ffff3754d7f in g_utf8_substring () from /usr/lib64/libglib-2.0.so.0
#4  0x000000000048095e in cb_text_transform_text (text=0x31a97f0 "@j5blythe", 
    entities=0x3420ec0, n_entities=3, flags=1, n_medias=0, quote_id=0, 
    display_range_start=17) at CbTextTransform.c:122
(More stack frames follow...)
(gdb) select-frame 4
(gdb) p text
$5 = 0x31a97f0 "@j5blythe"
(gdb) p entities[i].to
$6 = 26

(gdb) p cur_end $7 = 9

It looks like the entities array is being miscalculated/misapplied somewhere.

IBBoard commented 7 years ago

The problem appears to be this tweet: https://twitter.com/LewisBlytheArt/status/853591832617521152

full_text is @dril @McDonalds @j5blythe and display_range is [17,26], but by the time it gets to cb_text_transform_text then the text has already been pruned down to the display range.

IBBoard commented 7 years ago

Okay, the problem appears to be commit f2d16ba for CbTypes.c, around line 201. It truncates the text for some tweets but not others. I'm assuming it is something to do with tweets vs minitweets, but I'm not yet familiar enough with the code to understand it and fix it without breaking it somewhere else!

baedert commented 7 years ago

the replies branch from when? With or without https://github.com/baedert/corebird/commit/872069e683b6514b861ac52d4b9a5ef5c199e865 ?

IBBoard commented 7 years ago

Turns out without. I was up-to-date this morning. Didn't think to check for updates by the time I'd hit the problem. Sorry.