Re: [bug] possible condition depending on uninitialized value in _notmuch_message_sync

Subject: Re: [bug] possible condition depending on uninitialized value in _notmuch_message_sync

Date: Fri, 20 May 2022 09:46:39 -0300

To: Eliza Velasquez, notmuch@notmuchmail.org

Cc:

From: David Bremner


Eliza Velasquez <eliza@eliza.sh> writes:

> On Mon, May 16 2022 at 06:47 -03, David Bremner <david@tethera.net> wrote:
>
>> Ideally of course I'd like a reproducer in C.  It would help to have
>> line numbers in the valgrind output. It might be enough you install the
>> notmuch debug symbols?
>
> Took me a while to figure out the debugging workflow in NixOS, but I
> managed to capture the line numbers. At messsage.cc:1333, at the second
> condition below:
>
[snip]
> So I guess `message->modified' isn't correctly initialized, at least
> according to valgrind.
>
> -- 
> Eliza

Can you see if the following change quiets valgrind?

diff --git a/lib/message.cc b/lib/message.cc
index 63b216b6..bd3cb5af 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -169,6 +169,7 @@ _notmuch_message_create_for_document (const void *talloc_owner,
 
     message->doc = doc;
     message->termpos = 0;
+    message->modified = FALSE;
 
     return message;
 }
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: