unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Eliza Velasquez <eliza@eliza.sh>
To: notmuch@notmuchmail.org
Subject: [bug] possible condition depending on uninitialized value in _notmuch_message_sync
Date: Mon, 16 May 2022 02:27:53 -0700	[thread overview]
Message-ID: <87o7zxj086.fsf@eliza.sh> (raw)

Hello notmuch,

I noticed something peculiar while hacking on the notmuch Rust bindings.
One of the unit tests, when run through valgrind, consistently produced
this trace:

--8<---------------cut here---------------start------------->8---
==232461== Thread 2 test_tags::mutab:
==232461== Conditional jump or move depends on uninitialised value(s)
==232461==    at 0x486E8C6: _notmuch_message_sync (in /nix/store/w5i4pvirysllyh6wq5pxqcm62j4g36fl-notmuch-0.35/lib/libnotmuch.so.5.6.0)
==232461==    by 0x4870E6E: notmuch_message_remove_tag (in /nix/store/w5i4pvirysllyh6wq5pxqcm62j4g36fl-notmuch-0.35/lib/libnotmuch.so.5.6.0)
==232461==    by 0x1BE953: notmuch::message::Message::remove_tag (message.rs:125)
==232461==    by 0x15FD83: tests::test_tags::mutable::test_discard_not_present (test_tags.rs:118)
==232461==    by 0x159EC9: tests::test_tags::mutable::test_discard_not_present::{{closure}} (test_tags.rs:114)
==232461==    by 0x14FCBD: core::ops::function::FnOnce::call_once (function.rs:227)
==232461==    by 0x171B52: test::__rust_begin_short_backtrace (in /home/eliza/Git/notmuch-rs/target/debug/deps/tests-36359cb32ba337d6)
==232461==    by 0x171CD8: test::run_test_in_process (in /home/eliza/Git/notmuch-rs/target/debug/deps/tests-36359cb32ba337d6)
==232461==    by 0x19E2B7: _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17hd93c8f36d9bfcd36E.llvm.6931861783653830752 (in /home/eliza/Git/notmuch-rs/target/debug/deps/tests-36359cb32ba337d6)
==232461==    by 0x184605: core::ops::function::FnOnce::call_once{{vtable.shim}} (in /home/eliza/Git/notmuch-rs/target/debug/deps/tests-36359cb32ba337d6)
==232461==    by 0x2896E2: std::sys::unix::thread::Thread::new::thread_start (in /home/eliza/Git/notmuch-rs/target/debug/deps/tests-36359cb32ba337d6)
==232461==    by 0x4D9CEB1: start_thread (in /nix/store/ayrsyv7npr0lcbann4k9lxr19x813f0z-glibc-2.34-115/lib/libc.so.6)
--8<---------------cut here---------------end--------------->8---

The test definition follows.

--8<---------------cut here---------------start------------->8---
#[test]
fn test_discard_not_present() {
    let tagset = TagSetFixture::new(true, false);
    assert!(!tagset.message.tags().any(|x| x == "foo"));

    tagset.message.remove_tag("foo").unwrap();
}
--8<---------------cut here---------------end--------------->8---

First line, when called with these two arguments, creates a new notmuch
database with a single dummy message and opens it in `ReadWrite' mode.
Investigating the rest of the Rust-side of the stack trace, I didn't
find anything particularly suspicious in the way it handles memory.

Is it possible then that there's a potential memory error with removing
a non-existent tag on a message? I wanted to ask about this on the
mailing list before diving in deeper, since this isn't quite the latest
version of notmuch and I wasn't sure if it had been fixed in 0.36. I
searched the mailing list archives for this particular issue, but I
wasn't able to find anything.

-- 
Eliza

             reply	other threads:[~2022-05-16  9:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16  9:27 Eliza Velasquez [this message]
2022-05-16  9:47 ` [bug] possible condition depending on uninitialized value in _notmuch_message_sync David Bremner
2022-05-16 11:33   ` Eliza Velasquez
2022-05-16 12:01     ` David Bremner
2022-05-20 12:46     ` David Bremner
2022-05-25  1:42       ` Eliza Velasquez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7zxj086.fsf@eliza.sh \
    --to=eliza@eliza.sh \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).