After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 701572 - g_object_unref: assertion `G_IS_OBJECT (object)' failed when parsing message with StreamCat
g_object_unref: assertion `G_IS_OBJECT (object)' failed when parsing message ...
Status: RESOLVED FIXED
Product: gmime
Classification: Other
Component: general
2.6.x
Other Linux
: Normal normal
: ---
Assigned To: Jeffrey Stedfast
Jeffrey Stedfast
Depends on:
Blocks:
 
 
Reported: 2013-06-04 01:40 UTC by Jim Nelson
Modified: 2013-07-02 13:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Archive of test case with spam email in two parts, header and body (113.85 KB, application/x-xz)
2013-07-01 23:33 UTC, Jim Nelson
Details

Description Jim Nelson 2013-06-04 01:40:31 UTC
I recently received a message marked as spam that causes the above assertion when parsing.  However, it only occurs when the message is parsed with GMimeStreamCat (the header buffer from one stream, the body buffer from another).  If they're loaded into a single buffer and parsed, there's no problem.

The broader issue is that I run with fatal-warnings, and so this causes Geary to crash for me every time.

I'm concerned about attaching the message directly here, as it's spam and has a ZIP attachment that holds a .EXE.  If someone wants to see the message, I can email it directly.

I have a Vala program which reproduces this problem.  It looks like this:

void main(string[] args) {
    GMime.init(0);
    
    try {
        string header;
        FileUtils.get_contents("header.txt", out header);
        
        string body;
        FileUtils.get_contents("body.txt", out body);
        
        GMime.StreamCat stream_cat = new GMime.StreamCat();
        stream_cat.add_source(new GMime.StreamMem.with_buffer(header.data));
        stream_cat.add_source(new GMime.StreamMem.with_buffer(body.data));
        
        GMime.Parser parser = new GMime.Parser.with_stream(
            stream_cat);
        parser.construct_message();
    } catch (Error err) {
        stderr.printf("%s\n", err.message);
    }
}

... where header.txt has the headers and body.txt the body.
Comment 1 Jeffrey Stedfast 2013-06-29 17:43:23 UTC
Can you run this under gdb and set a breakpoint on g_logv and get a backtrace of where this log message occurs?

and/or attach the headers.txt and body.txt files?
Comment 2 Jim Nelson 2013-07-01 23:32:25 UTC
When run with G_DEBUG=fatal-warnings:

  • #0 g_logv
    at /build/buildd/glib2.0-2.36.0/./glib/gmessages.c line 981
  • #1 g_log
    at /build/buildd/glib2.0-2.36.0/./glib/gmessages.c line 1010
  • #2 parser_construct_leaf_part
    at gmime-parser.c line 1675
  • #3 parser_scan_multipart_subparts
    at gmime-parser.c line 1783
  • #4 parser_construct_multipart
    at gmime-parser.c line 1844
  • #5 parser_construct_message
    at gmime-parser.c line 1954
  • #6 g_mime_parser_construct_message
    at gmime-parser.c line 1987
  • #7 _vala_main
    at /home/jim/bug7034/test.vala line 18
  • #8 main
    at /home/jim/bug7034/test.vala line 2

I'll attach an archive with all the necessary files to build and execute.  I'm compiling with latest Vala, 0.20.1.
Comment 3 Jim Nelson 2013-07-01 23:33:16 UTC
Created attachment 248191 [details]
Archive of test case with spam email in two parts, header and body
Comment 4 Jeffrey Stedfast 2013-07-02 13:54:34 UTC
thanks! fixed in git master