Package: python3-notmuch
Version: 0.18-3
Severity: minor

If a message starts with the "From " postmark (i.e., it's in the mbox format), and you ask the get_header() method for a non-existent header, it raises NullPointerError, instead of returning empty string.

Now, I realize that support for indexing mbox files has been dropped, but users might still have them on disk, indexed by an old version of notmuch. This is how I discovered this bug.

I've attached my crafted mail archive (which I indexed with wheezy's notmuch), and the script that I used for testing:

$ python3 test.py
OK
NullPointerError()


-- System Information:
Debian Release: jessie/sid
 APT prefers unstable
 APT policy: (990, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.14-1-amd64 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages python3-notmuch depends on:
ii  libnotmuch3  0.18-3+b1

--
Jakub Wilk

Attachment: mail.tar.gz
Description: application/gzip

#!/usr/bin/python3

import notmuch

with notmuch.Database() as db:
    query = db.create_query('')
    for msg in query.search_messages():
        try:
            assert msg.get_header('Subject') == 'Hello world!'
            assert msg.get_header('Does-Not-Exist') == ''
        except Exception as exc:
            print(ascii(exc))
        else:
            print('OK')

# vim:ts=4 sw=4 et

Reply via email to