diff --git a/contrib/pgcrypto/expected/pgp-decrypt.out b/contrib/pgcrypto/expected/pgp-decrypt.out new file mode 100644 index 859f4d6..7193dca *** a/contrib/pgcrypto/expected/pgp-decrypt.out --- b/contrib/pgcrypto/expected/pgp-decrypt.out *************** a3nsOzKTXUfS9VyaXo8IrncM6n7fdaXpwba/3tNs *** 364,366 **** --- 364,374 ---- (1 row) -- expected: 7efefcab38467f7484d6fa43dc86cf5281bd78e2 + -- check BUG #11905, problem with messages 6 less than a power of 2. + select pgp_sym_decrypt(pgp_sym_encrypt(repeat('x',65530),'1'),'1') = repeat('x',65530); + ?column? + ---------- + t + (1 row) + + -- expected: true diff --git a/contrib/pgcrypto/pgp-decrypt.c b/contrib/pgcrypto/pgp-decrypt.c new file mode 100644 index 9aabd66..704cf2e *** a/contrib/pgcrypto/pgp-decrypt.c --- b/contrib/pgcrypto/pgp-decrypt.c *************** pktreader_pull(void *priv, PullFilter *s *** 182,188 **** 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) diff --git a/contrib/pgcrypto/sql/pgp-decrypt.sql b/contrib/pgcrypto/sql/pgp-decrypt.sql new file mode 100644 index 93535ab..5457152 *** a/contrib/pgcrypto/sql/pgp-decrypt.sql --- b/contrib/pgcrypto/sql/pgp-decrypt.sql *************** a3nsOzKTXUfS9VyaXo8IrncM6n7fdaXpwba/3tNs *** 264,266 **** --- 264,270 ---- -----END PGP MESSAGE----- '), 'key', 'convert-crlf=1'), 'sha1'), 'hex'); -- expected: 7efefcab38467f7484d6fa43dc86cf5281bd78e2 + + -- check BUG #11905, problem with messages 6 less than a power of 2. + select pgp_sym_decrypt(pgp_sym_encrypt(repeat('x',65530),'1'),'1') = repeat('x',65530); + -- expected: true