EionRobb / pidgin-pushbullet

A Pushbullet plugin for Pidgin
GNU General Public License v3.0
42 stars 12 forks source link

Segfault when receiving a text #6

Open tremby opened 8 years ago

tremby commented 8 years ago

Name and number edited, the rest is verbatim from gdb. I don't know gdb: let me know if you want me to run anything else. This is reproducible every time I receive a text. So far the chat window has always been open and focussed when the message is received; not sure if anything would change if that were not the case.

I'm on Ubuntu 14.04.2 on x86_64, Pidgin 2.10.11, purple 2.10.11.

GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/pidgin...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/pidgin 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe17a9700 (LWP 10027)]
[New Thread 0x7fffc684e700 (LWP 10030)]
[New Thread 0x7fffc5a83700 (LWP 10031)]
[New Thread 0x7fffc5282700 (LWP 10032)]
[New Thread 0x7fffc4a81700 (LWP 10033)]
Traceback (most recent call last):
  File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module>
    from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
[Thread 0x7fffc5282700 (LWP 10032) exited]
[Thread 0x7fffc4a81700 (LWP 10033) exited]

Program received signal SIGSEGV, Segmentation fault.
__strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:29
29  ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S: No such file or directory.
(gdb) bt
#0  __strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:29
#1  0x00007ffff559cfc9 in g_str_equal () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fffedceddde in pb_set_base64_icon_for_buddy (buddy=0x555556288680, 
    base64_icon=0x555556045390 "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcU\nFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgo\nKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKC"...) at libpushbullet.c:118
#3  pb_got_phone_threads (pba=0x555555f37060, node=<optimized out>, user_data=0x5555561a84a0) at libpushbullet.c:616
#4  0x00007fffedced890 in pb_response_callback (url_data=<optimized out>, user_data=0x555556990300, 
    url_text=0x555555c79cc0 "{\"key\":\"ujEuSe57Vu0sjAnBdJA0yG_threads\",\"data\":{\"threads\":[{\"id\":\"4\",\"recipients\":[{\"name\":\"Bob McCorrin\",\"address\":\"+1 555-555-5555\",\"number\":\"+1 555-555-5555\",\"thumbnail\":\"\\/9j\\/4AAQSkZJRgABAQAAAQAB"..., len=<optimized out>, error_message=<optimized out>) at libpushbullet.c:148
#5  0x00007ffff52d8651 in ?? () from /usr/lib/libpurple.so.0
#6  0x00005555555c8a5e in ?? ()
#7  0x00007ffff55acce5 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#8  0x00007ffff55ad048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#9  0x00007ffff55ad30a in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#10 0x00007ffff6835447 in gtk_main () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#11 0x000055555558f8f3 in main ()
(gdb) bt full
#0  __strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:29
No locals.
#1  0x00007ffff559cfc9 in g_str_equal () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#2  0x00007fffedceddde in pb_set_base64_icon_for_buddy (buddy=0x555556288680, 
    base64_icon=0x555556045390 "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcU\nFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgo\nKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKC"...) at libpushbullet.c:118
        icon_data = <optimized out>
        icon_len = 140737187453535
        checksum = 0x5555569d20c0 "3466199746d"
#3  pb_got_phone_threads (pba=0x555555f37060, node=<optimized out>, user_data=0x5555561a84a0) at libpushbullet.c:616
        first_recipient = <optimized out>
        thread = 0x555556bec340
        id = 0x555556dda530 "4"
        recipients = <optimized out>
        from = 0x555556938e00 "+1 555-555-5555"
        account = 0x555555ada940
        rootobj = <optimized out>
        data = <optimized out>
        threads = 0x555555d5fdb0
        i = 0
        len = 6
        device = 0x5555561a84a0 "ujEuSe57Vu0sjAnBdJA0yG"
        last_message_timestamp = 1440460880
        newest_phone_message_id = 0
#4  0x00007fffedced890 in pb_response_callback (url_data=<optimized out>, user_data=0x555556990300, 
    url_text=0x555555c79cc0 "{\"key\":\"ujEuSe57Vu0sjAnBdJA0yG_threads\",\"data\":{\"threads\":[{\"id\":\"4\",\"recipients\":[{\"name\":\"Bob McCorrin\",\"address\":\"+1 555-555-5555\",\"number\":\"+1 555-555-5555\",\"thumbnail\":\"\\/9j\\/4AAQSkZJRgABAQAAAQAB"..., len=<optimized out>, error_message=<optimized out>) at libpushbullet.c:148
        root = 0x555556bea8a0
        conn = 0x555556990300
        parser = 0x555556c12900
#5  0x00007ffff52d8651 in ?? () from /usr/lib/libpurple.so.0
No symbol table info available.
#6  0x00005555555c8a5e in ?? ()
No symbol table info available.
#7  0x00007ffff55acce5 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#8  0x00007ffff55ad048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#9  0x00007ffff55ad30a in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#10 0x00007ffff6835447 in gtk_main () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
No symbol table info available.
#11 0x000055555558f8f3 in main ()
No symbol table info available.
(gdb)
EionRobb commented 8 years ago

That looks like it's crashing trying to set the buddy icon for a buddy. Looks like we need to add a null check to the old checksum of the buddy icon, or switch to using purple_str_equal() instead in line 118. I'm away from a computer for the next few days, but if you want to try making that change yourself and let me know how you get on?

tremby commented 8 years ago

Okay, I've done this and now it's complaining about double free or corruption (!prev), which happens on line 131. I tried wrapping this in if (icon_data != NULL) but that didn't help.

I don't know what I'm doing here! But am willing to fumble through with guidance.

tremby commented 8 years ago

(I tried the purple_str_equal() you suggested first, btw, but there was an error. Now that I think back, it may have been this same one, so that might have been nicer than making a new variable for old_checksum. But would it be automatically freed after use, if not put in a new variable and then explicitly freed? I never did much C!)

tremby commented 8 years ago

I take that back; with purple_str_equal() it compiles fine and Pidgin loads fine, but the plugin is not available in the menu. I can't see any error messages.