Re: BUG #11905: "Error: Wrong key or corrupt data" with pgp_sym_decrypt when bytea size is 2^x - 6 where x >=14

From: Marko Tiikkaja <marko(at)joh(dot)to>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, connor(dot)penhale(at)openlogic(dot)com
Cc: Pg Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #11905: "Error: Wrong key or corrupt data" with pgp_sym_decrypt when bytea size is 2^x - 6 where x >=14
Date: 2014-11-11 18:11:20
Message-ID: 54625148.2060105@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2014-11-11 18:52, Jeff Janes wrote:
> The problem is that mdc_read is getting invoked with an len argument of 0.
> When it successfully reads 0 bytes, it interprets that as an error. I
> can't figure out why it is getting invoked with a length of 0, too many
> pointer indirections for me to follow at this time.

This sounds a lot like another bug I've seen. Can you try this patch?

*** a/contrib/pgcrypto/pgp-decrypt.c
--- b/contrib/pgcrypto/pgp-decrypt.c
***************
*** 182,188 **** pktreader_pull(void *priv, PullFilter *src, int len,
if (pkt->type == PKT_CONTEXT)
return pullf_read(src, len, data_p);

! if (pkt->len == 0)
{
/* this was last chunk in stream */
if (pkt->type == PKT_NORMAL)
--- 182,188 ----
if (pkt->type == PKT_CONTEXT)
return pullf_read(src, len, data_p);

! while (pkt->len == 0)
{
/* this was last chunk in stream */
if (pkt->type == PKT_NORMAL)

.marko

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Janes 2014-11-11 20:33:39 Re: BUG #11905: "Error: Wrong key or corrupt data" with pgp_sym_decrypt when bytea size is 2^x - 6 where x >=14
Previous Message Jeff Janes 2014-11-11 17:52:08 Re: BUG #11905: "Error: Wrong key or corrupt data" with pgp_sym_decrypt when bytea size is 2^x - 6 where x >=14