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 1ehgWQ-0004pu-3q for pgsql-bugs@arkaria.postgresql.org; Fri, 02 Feb 2018 18:57:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ehgWO-0007Hy-Vy for pgsql-bugs@arkaria.postgresql.org; Fri, 02 Feb 2018 18:57:12 +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 1ehgNJ-0005ap-0a for pgsql-bugs@lists.postgresql.org; Fri, 02 Feb 2018 18:47:49 +0000 Received: from mail.tagan.ru ([95.174.96.5]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ehgND-0004iQ-84 for pgsql-bugs@postgresql.org; Fri, 02 Feb 2018 18:47:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tagan.ru; s=dkim; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=JH1TLZpAoMmzgqNmHAEuJXSKQZrERCU43sRVTo7dxUQ=; b=e8bn/9aSrcBmStQczhdbXWpO3H 5eQ4/T0DLWlWyNaPppPYyoNKZ4PyOK1wGRZds22cImf7B4sy/PUdvlAUc61taByXtn2WTA0QP/ZA+ 1L+EtdRivVEYNckTkRFVkucPNtJ1hTUcgJMt1RbsmyWkW8be8NwHsX/2pHsN+9/is2c8=; Received: from [87.117.50.241] (helo=ahpeb) by mail.tagan.ru with esmtpsa auth=asper (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1ehgN5-0007Vn-Dd; Fri, 02 Feb 2018 21:47:35 +0300 Date: Fri, 2 Feb 2018 21:47:46 +0300 From: Michael To: "David G. Johnston" Cc: Rainer Pruy , Pavan Teja , Mike Porter , Postgres Bug Subject: Re: crypt function crash on postgresql 9.3.20 and 10 Message-ID: <20180202214746.10221aea@ahpeb> In-Reply-To: References: <5059192d-2ff7-41c2-1070-708cb65f33e9@tagan.ru> <965ca7cd-1c5c-ebdd-0fb1-1d7dbc1c7038@acrys.com> Organization: MGL X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =D0=92 Fri, 2 Feb 2018 08:29:08 -0700 "David G. Johnston" =D0=BF=D0=B8=D1=88=D0=B5= =D1=82: > On Fri, Feb 2, 2018 at 8:24 AM, Rainer Pruy > wrote: >=20 > > > > On 02.02.2018 15:58, =D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB =D0=9C=D0=B0= =D0=BD=D0=B5=D1=80=D0=BA=D0=BE wrote: > > > > 02.02.2018 17:55, David G. Johnston =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > > > On Fri, Feb 2, 2018 at 7:50 AM, Pavan Teja > > wrote: > > =20 > >> > >> > >> On Feb 2, 2018 8:15 PM, "Mike Porter" wrote: > >> > >> On Fri, 2 Feb 2018, =D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB =D0=9C=D0=B0= =D0=BD=D0=B5=D1=80=D0=BA=D0=BE wrote: > >> > >> If you send an asterisk in the crypt function, the function > >> crashes. =20 > >>> > >>> > >>> example > >>> > >>> i=3D# select crypt('123','*'); > >>> =D0=9E=D0=A8=D0=98=D0=91=D0=9A=D0=90: invalid salt > >>> i=3D# > >>> =20 > >> > >> =20 > > function takes the text parameter > > Should it fall from a 1-character long text? > > > > > > Yes, exactly! > > This is similar to calling "sqrt(-1)". The parameter is invalid for > > the function, such thatthe function can not be performed. > > =20 >=20 > =E2=80=8BRight. >=20 > Functions generally (rarely, never) have domain types created for > them that would prevent invalid input values from even being > created. Defining constraints on input values is usually left up to > the documentation. In this case the documentation describes how to > properly use the function. Used properly a single-character long text > string should never be input into the function - so it wasn't deemed > necessary to document that if one supplies such a string incorrectly > that the function will error out. That seems like a reasonable > decision (intentional or otherwise). >=20 > David J. However, in a postgresql 9.3.2, such a call does not lead to an error. how then should the function respond to a call select crypt('123',NULL); this does not cause an error