Postgresql Global Development Group
The use of the dangerous function `PQfn(..., result is int=0, ...)` within the libpq `lo export()`, `lo read()`, `lo lseek64()`, and `lo tell64()` functions allows a server superuser to overwrite a client stack buffer with an arbitrarily-large response. This occurs because the function stores server-determined data of arbitrary length into a buffer of unspecified size. Consequently, since the `lo export` command in psql and pg dump utilize `lo read()`, a server superuser can overwrite the stack memory of psql or pg dump.