Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f6kTs-0005Zh-4u for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Apr 2018 22:14:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f6kTq-0007MF-NN for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Apr 2018 22:14:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f6kTq-0007M6-Hb for pgsql-bugs@lists.postgresql.org; Thu, 12 Apr 2018 22:14:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f6kTn-0004qn-DR for pgsql-bugs@lists.postgresql.org; Thu, 12 Apr 2018 22:14:10 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w3CME3mo023885; Thu, 12 Apr 2018 18:14:03 -0400 From: Tom Lane To: Arthur Zakirov cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15150: Reading uninitialised value in NISortAffixes (tsearch/spell.c) In-reply-to: <20180412115638.GA19444@zakirov.localdomain> References: <152353327780.31225.13445405496721177988@wrigleys.postgresql.org> <20180412115638.GA19444@zakirov.localdomain> Comments: In-reply-to Arthur Zakirov message dated "Thu, 12 Apr 2018 14:56:39 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23883.1523571243.1@sss.pgh.pa.us> Date: Thu, 12 Apr 2018 18:14:03 -0400 Message-ID: <23884.1523571243@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Arthur Zakirov writes: >> It looks that the following condition in NISortAffixes(IspellDict *Conf) >> uses uninitialised ptr->issuffix: >> if (ptr == Conf->CompoundAffix || >> ptr->issuffix != (ptr - 1)->issuffix || > Yes, you are right. The second condition isn't right. Instead of > "ptr->issuffix != (ptr - 1)->issuffix" "Affix->type" should be checked > because we check for uniqueness of affixes. Yeah, existing code is clearly wrong, patch looks OK, will push. But I see from the code coverage report that this bit is unexercised in the regression tests. Any chance of getting a test that covers this? I'm worried that this means we also lack any coverage of cases where the CompoundAffix array has more than one entry. regards, tom lane