[PATCH] after gzgets(), Z_STREAM_END means EOF, not error

2020-04-14 Thread Olivier Taïbi
As suggested by David Bremner in https://notmuchmail.org/pipermail/notmuch/2020/029288.html here is the patch for bug #3: after gzgets() returns NULL (meaning EOF or error), the error code Z_STREAM_END means EOF and not error. Context: I am compiling notmuch on OpenBSD which has a rather old zlib

[PATCH] gzerror() after gzclose_r() is a use after free

2020-04-14 Thread Olivier Taïbi
As suggested by David Bremner in https://notmuchmail.org/pipermail/notmuch/2020/029288.html here is a separate patch for bug #2: calling gzerror() (indirectly via gzerror_str()) after gzclose_r is a use after free, according to zlib's manual. diff --git a/notmuch-restore.c b/notmuch-restore.c

Re: [PATCH] after gzgets(), Z_STREAM_END means EOF, not error

2020-04-14 Thread Olivier Taïbi
On Tue, Apr 14, 2020 at 05:38:32PM -0300, David Bremner wrote: > Olivier Taïbi writes: > > PS: out of curiosity, why bother with the --gzip feature in notmuch dump > > and restore when the user can simply pipe to/from a gzip/bzip2/xz/... > > command? > > I beli

[PATCH] test: sort the output of the "prefix" test in T610-message-property as needed

2020-04-17 Thread Olivier Taïbi
the "prefix" test in T610-message-property extracts values from a (key,value) map where multiple entries can have the same key, and the entries are sorted by key, but not by value. The test incorrectly assumes that the values will be sorted as well, so correct this by splitting the output using

[PATCH] zlib-related bugs

2020-04-12 Thread Olivier Taïbi
the following diff addresses 3 zlib-related bugs in notmuch. 1) the second argument of gzerror() cannot be NULL, so replace it by a dummy 2) gzerror() cannot be closed after gzclosed(), so just print the error value instead. 3) in gz_getline(), if gz_error sets its second argument to

[PATCH] test: sort the output of the "prefix" test in T610-message-property

2020-04-19 Thread Olivier Taïbi
This test extracts values from a (key,value) map where multiple entries can have the same key, and the entries are sorted by key, but not by value. The test incorrectly assumes that the values will be sorted as well, so sort the output. --- test/T610-message-property.sh | 12 1 file