Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XhLFQ-0000jj-DA for pgsql-bugs@arkaria.postgresql.org; Thu, 23 Oct 2014 16:28:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XhLFP-0004yP-Qd for pgsql-bugs@arkaria.postgresql.org; Thu, 23 Oct 2014 16:28:23 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XhLFO-0004yI-OE for pgsql-bugs@postgresql.org; Thu, 23 Oct 2014 16:28:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XhLFL-0006Hi-78 for pgsql-bugs@postgresql.org; Thu, 23 Oct 2014 16:28:21 +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 s9NGSGE5005850; Thu, 23 Oct 2014 12:28:17 -0400 From: Tom Lane To: emre@hasegeli.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #11770: Segfault on spell.c when there are more than one characters as suffix flag In-reply-to: <20141023092838.2674.7830@wrigleys.postgresql.org> References: <20141023092838.2674.7830@wrigleys.postgresql.org> Comments: In-reply-to emre@hasegeli.com message dated "Thu, 23 Oct 2014 09:28:38 -0000" Date: Thu, 23 Oct 2014 12:28:16 -0400 Message-ID: <5849.1414081696@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org emre@hasegeli.com writes: > How to reproduce: > ... > Note that the affix file is not correct without "FLAG num" which is not > supported by PostgreSQL. Also, the code fails to report the proper error > on spell.c:673 when "FLAG num" is used. Hmm. The immediate cause of the crash is that the code is expecting some "CompoundAffix"es to exist when usecompound = true, but they don't. I'm not sure whether we should flag the affix file as invalid, but in any case it'd be a good idea for CheckCompoundAffixes to defend itself against *ptr being NULL. As for whether the error is proper ... this code is woefully underdocumented, but it looks to me like NIImportAffixes() is designed to import the original ispell affix file format, and if it decides that the file is not that but MySpell/Hunspell format then it sends control off to NIImportOOAffixes to re-parse the whole thing. The difficulty is that FLAG commands exist in both formats and it's not being careful about whether the FLAG command is new or old format. Probably we should insist that the FLAG argument not contain multiple letters in order to deem it old format. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs