Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bN0l8-0000VG-R9 for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Jul 2016 16:42:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bN0l8-00042p-D9 for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Jul 2016 16:42:10 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bN0jm-0002U8-Gu for pgsql-hackers@postgreSQL.org; Tue, 12 Jul 2016 16:40:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bN0jf-0004eJ-BZ for pgsql-hackers@postgreSQL.org; Tue, 12 Jul 2016 16:40:45 +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 u6CGeY05026006; Tue, 12 Jul 2016 12:40:34 -0400 From: Tom Lane To: Andreas Seltenreich cc: pgsql-hackers@postgreSQL.org Subject: Re: GiST index build versus NaN coordinates In-reply-to: <878tx7491q.fsf@credativ.de> References: <28685.1468246504@sss.pgh.pa.us> <878tx7491q.fsf@credativ.de> Comments: In-reply-to Andreas Seltenreich message dated "Tue, 12 Jul 2016 09:20:17 +0200" Date: Tue, 12 Jul 2016 12:40:34 -0400 Message-ID: <26005.1468341634@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Andreas Seltenreich writes: > Tom Lane writes: >> More generally, this example makes me fearful that NaN coordinates in >> geometric values are likely to cause all sorts of issues. It's too late >> to disallow them, probably, but I wonder how can we identify other bugs >> of this ilk. > Sounds like some fuzz testing with nan/infinity is in order. sqlsmith > doesn't generate any float literals, but it calls functions to satisfy > its need for values of specific types. Adding suitable functions[1] to > the regression db, I made the following observations: This is really useful, thanks! > The infinite loop from the bug report was triggered. Further, two > previously unseen errors are logged: > ERROR: timestamp cannot be NaN > ERROR: getQuadrant: impossible case > The first is porbably as boring as it gets, the second one is from the > getQuadrant() in spgquadtreeproc.c. Yeah, the first one is presumably from float8_timestamptz() intentionally rejecting a NaN, which seems fine. > Curiously, the getQuadrant()s in geo_spgist.c and rangetypes_spgist.c do > not have such a check. I guess the boxes will just end up in an > undefined position in the index for these. Right, we probably want them all to apply some consistent ordering --- doesn't matter so much what it is, but float8's rule is as good as any. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers