Re: Fix misuse use of pg_b64_encode function (contrib/postgres_fdw/connection.c) - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Fix misuse use of pg_b64_encode function (contrib/postgres_fdw/connection.c)
Date
Msg-id 700f7411-e4ab-45f0-96a0-7e41501f93be@eisentraut.org
Whole thread Raw
In response to Re: Fix misuse use of pg_b64_encode function (contrib/postgres_fdw/connection.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: Fix misuse use of pg_b64_encode function (contrib/postgres_fdw/connection.c)
List pgsql-hackers
On 16.01.25 11:23, Ranier Vilela wrote:
> 
> 
> Em qui., 16 de jan. de 2025 às 05:07, Peter Eisentraut 
> <peter@eisentraut.org <mailto:peter@eisentraut.org>> escreveu:
> 
>     On 16.01.25 02:12, Ranier Vilela wrote:
>      > Per Coverity.
>      >
>      > CID 1590024:    (CHECKED_RETURN)
>      > Calling "pg_b64_encode" without checking return value (as is done
>      > elsewhere 8 out of 10 times).
>      >
>      > The function *pg_b64_encode* has in the comments:
>      > [0]  "and -1 in the event of an error"
>      >
>      > So, the function can fail.
>      > All other calls check the return, In this case it could not be
>     different.
>      >
>      > Fix by checking the return and reporting a message to the user,
>      > in case of failure.
> 
>     Thanks, fixed.  (I changed the ereports to elogs, which is how other
>     call sites do it.)
> 
> Thank you.
> 
> 
>     I also fixed a related problem in the pg_b64_decode() calls in libpq.
> 
>     Maybe we could put a pg_nodiscard attribute on pg_b64_encode() and
>     pg_b64_decode()?
> 
> +1

done




pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Conflict detection for update_deleted in logical replication
Next
From: Yura Sokolov
Date:
Subject: Re: Increase NUM_XLOGINSERT_LOCKS