Re: crypt function crash on postgresql 9.3.20 and 10

From: Michael <asper(at)tagan(dot)ru>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Rainer Pruy <Rainer(dot)Pruy(at)acrys(dot)com>, Pavan Teja <pavan(dot)postgresdba(at)gmail(dot)com>, Mike Porter <mike(at)udel(dot)edu>, Postgres Bug <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: crypt function crash on postgresql 9.3.20 and 10
Date: 2018-02-02 18:47:46
Message-ID: 20180202214746.10221aea@ahpeb
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

В Fri, 2 Feb 2018 08:29:08 -0700
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> пишет:

> On Fri, Feb 2, 2018 at 8:24 AM, Rainer Pruy <Rainer(dot)Pruy(at)acrys(dot)com>
> wrote:
>
> >
> > On 02.02.2018 15:58, Михаил Манерко wrote:
> >
> > 02.02.2018 17:55, David G. Johnston пишет:
> >
> > On Fri, Feb 2, 2018 at 7:50 AM, Pavan Teja
> > <pavan(dot)postgresdba(at)gmail(dot)com> wrote:
> >
> >>
> >>
> >> On Feb 2, 2018 8:15 PM, "Mike Porter" <mike(at)udel(dot)edu> wrote:
> >>
> >> On Fri, 2 Feb 2018, Михаил Манерко wrote:
> >>
> >> If you send an asterisk in the crypt function, the function
> >> crashes.
> >>>
> >>>
> >>> example
> >>>
> >>> i=# select crypt('123','*');
> >>> ОШИБКА: invalid salt
> >>> i=#
> >>>
> >>
> >>
> > 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.
> >
>
> ​Right.
>
> 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).
>
> 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2018-02-02 18:53:06 Re: crypt function crash on postgresql 9.3.20 and 10
Previous Message David G. Johnston 2018-02-02 15:29:08 Re: crypt function crash on postgresql 9.3.20 and 10