iCyberon / pg_hashids

Short unique id generator for PostgreSQL, using hashids
MIT License
287 stars 25 forks source link

Segmentation fault (Postgres crash) #18

Closed emrul closed 4 years ago

emrul commented 5 years ago

Hi,

I'm using pg_hashids v1.2.1 and have found that the following code will crash the Postgres Postmaster:

SELECT id_decode(null);

and this in the Postgres logs:

2019-02-24 21:16:51.332 UTC [1] LOG:  server process (PID 49322) was terminated by signal 11: Segmentation fault
2019-02-24 21:16:51.332 UTC [1] DETAIL:  Failed process was running: SELECT id_decode(null)
2019-02-24 21:16:51.332 UTC [1] LOG:  terminating any other active server processes
2019-02-24 21:16:51.333 UTC [49319] WARNING:  terminating connection because of crash of another server process

I'm not sure what the correct behaviour ought to be (to return NULL or {0}) but believe an outright crash should be avoidable?

dwagin commented 4 years ago

fixed in #22