Segmentation fault in notmuch search --format=json

Ben Gamari bgamari.foss at gmail.com
Mon Aug 6 22:52:52 PDT 2012


It seems some messages trigger a segmentation fault in
`do_search_threads()`. It appears the problem occurs (at least) when
`authors` is NULL.

    Program received signal SIGSEGV, Segmentation fault.
    0x0000000000415aa3 in json_string (sp=0x646c70, val=0x0) at sprinter-json.c:121
    121	    json_string_len (sp, val, strlen (val));
    (gdb) bt
    #0  0x0000000000415aa3 in json_string (sp=0x646c70, val=0x0)
        at sprinter-json.c:121
    #1  0x000000000041084b in do_search_threads (format=0x646c70, query=0x64bb70, 
        sort=NOTMUCH_SORT_NEWEST_FIRST, output=OUTPUT_SUMMARY, offset=0, limit=-1)
        at notmuch-search.c:131
    #2  0x0000000000411361 in notmuch_search_command (ctx=0x6361b0, argc=3, 
        argv=0x7fffffffdfb0) at notmuch-search.c:405
    #3  0x0000000000409e22 in main (argc=4, argv=0x7fffffffdfa8) at notmuch.c:294
    (gdb) up
    #1  0x000000000041084b in do_search_threads (format=0x646c70, query=0x64bb70, 
        sort=NOTMUCH_SORT_NEWEST_FIRST, output=OUTPUT_SUMMARY, offset=0, limit=-1)
        at notmuch-search.c:131
    131			format->string (format, authors);
    (gdb) list
    126			format->map_key (format, "matched");
    127			format->integer (format, matched);
    128			format->map_key (format, "total");
    129			format->integer (format, total);
    130			format->map_key (format, "authors");
    131			format->string (format, authors);
    132			format->map_key (format, "subject");
    133			format->string (format, subject);
    134		    }
    135	
    (gdb) 

It seems that the message in question was produced by a script I use to
feed RSS feeds into notmuch so while I wouldn't doubt that there are few
cases where `authors` should be NULL, it would be nice if notmuch
handled this case with a bit more grace.

Cheers,

- Ben



More information about the notmuch mailing list