From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id EDAfBa25cWGEPwEAgWs5BA (envelope-from ) for ; Thu, 21 Oct 2021 21:04:13 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id KAqWAK25cWEAWAAAbx9fmQ (envelope-from ) for ; Thu, 21 Oct 2021 19:04:13 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8BC5F1B82C for ; Thu, 21 Oct 2021 21:04:11 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 94C2129026; Thu, 21 Oct 2021 15:04:07 -0400 (EDT) Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by mail.notmuchmail.org (Postfix) with ESMTPS id 3318329024 for ; Thu, 21 Oct 2021 15:04:04 -0400 (EDT) Received: by mail-qk1-x72e.google.com with SMTP id h65so2650464qke.0 for ; Thu, 21 Oct 2021 12:04:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=austinray-io.20210112.gappssmtp.com; s=20210112; h=date:from:to:subject:message-id:mime-version:content-disposition; bh=mhyuFeo0fgatMI1rLGsaS3cHz+x5askWF9qxumlJYrk=; b=2S95in4ko7qEyGxnj/gwUEpGBUfEbwqEVvmSburSn26Pq0UR93lrcu46xYm9Yrfrxf Z+wFI5b3g/AFh097Ps3v4n6BYozgqwYcuzPxjyjN9LbbV66gi/w6ms30SWza3TYFzASU 9rmyBj01NccZyFarMiAkyxiFrFvnfX9VOnFvh/5j/c4v+VVbVt8vLGlArOaO0AaEqdfX YHvd3ldsWberOZArh+lxLjuv9r2DXRL8yORnYg2V7bacgjAUMT6+QPlG/PYzg+OlozQU wEWW8fB8txGBWtko4d87oQOpgOGopJWZ0YHQeMnjeB3h60sAJGiIVzHXf+vEJJnm3Qex XT/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition; bh=mhyuFeo0fgatMI1rLGsaS3cHz+x5askWF9qxumlJYrk=; b=jueTGgpreXolqgvpW2pyjE79gi+Eosf8SOnUxa7pwwdDl0pjeKO55DG5LPlxvAfC6b wuORxnPE6IQGcRfw979m5VGGeZ7msG0/CuzeL+7/BsLM0AVbEdevI9YnTe2map4AX850 TlSx1fIcIUHC1ZTWEx2RjEGzUbALWdlAYl529yh8gsTq3LyJaIlxdf5LN9DXftf5FGPF 3QSQG6OecSOaiAU5rMgYtF3hJjeUr5y9S6z9hLTTqwjb31prNx+fplP4lC6ETSDUWZWk 4mdtvDldx0Wt/L30cESviO8g85H9uV1fcYQ4r4tb4kftI9PNWP7MN1CcejYPYDtWsTBf ScPg== X-Gm-Message-State: AOAM533tCHt6b1q2gH498XEfL17uwGS3JMJhade+XENdMIBxlMtWoXtd OKbqs2xU0Qgs1XW9o6265DrfWPt2kqc= X-Google-Smtp-Source: ABdhPJxna8jXzIFjZa001/raEEn0xJs1btGSUDy+Bm6Qa81RmcmBzD2TOnFU//fQerir1cQSV23Tqg== X-Received: by 2002:a05:620a:404f:: with SMTP id i15mr5864163qko.460.1634843042959; Thu, 21 Oct 2021 12:04:02 -0700 (PDT) Received: from localhost (68-20-11-88.lightspeed.rlghnc.sbcglobal.net. [68.20.11.88]) by smtp.gmail.com with ESMTPSA id w11sm3387623qta.50.2021.10.21.12.04.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 12:04:02 -0700 (PDT) Date: Thu, 21 Oct 2021 15:04:01 -0400 From: Austin Ray To: notmuch@notmuchmail.org Subject: notmuch_database_open_with_config() does not NULL pointer on error Message-ID: <20211021190401.imirxau2ewke6e2m@athena> MIME-Version: 1.0 Message-ID-Hash: YI4LS3NXRSJQ53ONB35USXEE2SDGUJ6P X-Message-ID-Hash: YI4LS3NXRSJQ53ONB35USXEE2SDGUJ6P X-MailFrom: austin@austinray.io X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: multipart/mixed; boundary="===============9007059910835784163==" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1634843052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type:list-id: list-help:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=5ZwHf0XtbGbQIUmZrm3SjAzqVU5wVklOP/fQgwJYLjA=; b=PtTnL04FIpcwRCCPeRtuLYpRpKb/a3w6h7r+pNJSIi1MqlMYi+2ecwi6E3iWMOkXR+T/FK 0ykLnD1sOoJ8nJOVktgrhg2GiJZdAtuB5YjImITjRXpPtCrM/OEcGk3Et72rQl+2tMAxTq tDdEM2fDT2AE9Y6JNaiWrxQnVlHq01dTNIX9DODNzCkKJVe8Wq1JZWHBVA/aqu/ZhouQFC peFFvNaVkjnB7i72169bi5UJbjmRjqC+WEoP5gPBCRRyUbuj68hMv/72zZl8XY20bCk6/h tH0ettsBC2jg7yMyPavQ69AbeNK6ZnA/gniJAHJTzydJKKoFG7HMvNJ3xSZZcw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1634843052; a=rsa-sha256; cv=none; b=hWVEpFl0RvVFgM/jbfVHF4C+DqRvr1FkKPgD0MOJsfzwPJSANEBu5H0VvzIHXRRt2ghQ5C bV6KkUSgD5pOQKf7asUO7iR+iN+6YHC2pEM0+tkna7UFdsx6h51Oamf5dkBGpZ+tSlqTCU wW6jMtnkAYGq1FQ0xx/SkgGg6kndfkWizyvZs+giF3mSK4sx7WnHlyqKDYlBcoaXXwf43e hJhDP72nj7NbjzpSGrVLpzcemqvDubr3Lw5/CbOhstK2cV5qrZcOu1Xb6Q6554rgP41Tog lsFKnCmhcTXbQBVYm5sddfcf/TtpVPrqx+0x9C7IKFeqaaro98MFEDbVLNijNA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=austinray-io.20210112.gappssmtp.com header.s=20210112 header.b=2S95in4k; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -2.60 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=austinray-io.20210112.gappssmtp.com header.s=20210112 header.b=2S95in4k; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 8BC5F1B82C X-Spam-Score: -2.60 X-Migadu-Scanner: scn0.migadu.com X-TUID: 97dHCYUC+tgt --===============9007059910835784163== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="aravujj6fld6ttvx" Content-Disposition: inline --aravujj6fld6ttvx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Submitting this bug report per bremner's request (thanks for the assist today!) The documentation for 'notmuch_database_open_with_config()' states: > In case of any failure, this function returns an error status and > sets *database to NULL. However, it's possible to trigger a failure and leave *database in a partially initialized state. Usage of this pointer causes a segfault in libnotmuch. Below is a small reproducer program that causes a no config file failure and outputs if it has a non-NULL database pointer. #include #include int main() { const char *db_path =3D "/home/aray/mail/"; notmuch_database_t *db =3D NULL; notmuch_status_t st =3D notmuch_database_open_with_config( db_path, NOTMUCH_DATABASE_MODE_READ_ONLY, NULL, NULL, &db, NULL); if (st !=3D NOTMUCH_STATUS_SUCCESS) { printf("Received status: %s\n", notmuch_status_to_string(st)); if (db) { printf("Received non-null DB pointer\n"); return -1; } } return 0; } Please set 'db_path' to your notmuch database path and call the program like such: NOTMUCH_CONFIG=3D"./nonexistent" ./reprod --=20 https://austinray.io Open Source Maintainer, Software Engineer, Keyboard Enthusiast GPG: 0127 ED83 B939 CCC9 8082 476E 1AA0 B115 C8AC 2C9E --aravujj6fld6ttvx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQTaYk66K9eIYbyUx+6J1sK5lQPcSQUCYXG5nQAKCRCJ1sK5lQPc SfnwAP0RT+tUngPkIvR9rli/EmERwYWjzJ5yArjgSQ+zqK02JwD/XG1maIH/GQTV aeEMopn1D9TXFZs0ypnU72bvo2WNRwg= =VacE -----END PGP SIGNATURE----- --aravujj6fld6ttvx-- --===============9007059910835784163== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============9007059910835784163==--