Improve pglz_decompress() so that it cannot clobber memory beyond the available output buffer when presented with corrupt input.  Some testing suggests that this slows the decompression loop about 1%, which seems an acceptable price to pay for more robustness.  (Curiously, the penalty seems to be *less* on not-very-compressible data, which I didn't expect since the overhead per output byte ought to be more in the literal-bytes path.)
Improve pglz_decompress() so that it cannot clobber memory beyond the
available output buffer when presented with corrupt input.  Some testing
suggests that this slows the decompression loop about 1%, which seems an
acceptable price to pay for more robustness.  (Curiously, the penalty
seems to be *less* on not-very-compressible data, which I didn't expect
since the overhead per output byte ought to be more in the literal-bytes
path.)

Patch from Zdenek Kotala.  I fixed a corner case and did some renaming
of variables to make the routine more readable.

jmcatamney/gpdb,edespino/gpdb,yazun/postgres-xl,tpostgres-projects/tPostgres,ashwinstar/gpdb,ashwinstar/gpdb,adam8157/gpdb,postmind-net/postgres-xl,kmjungersen/PostgresXL,Postgres-XL/Postgres-XL,greenplum-db/gpdb,Chibin/gpdb,yuanzhao/gpdb,ovr/postgres-xl,edespino/gpdb,zeroae/postgres-xl,50wu/gpdb,jmcatamney/gpdb,lisakowen/gpdb,adam8157/gpdb,xinzweb/gpdb,pavanvd/postgres-xl,tpostgres-projects/tPostgres,greenplum-db/gpdb,50wu/gpdb,lisakowen/gpdb,Chibin/gpdb,postmind-net/postgres-xl,yuanzhao/gpdb,techdragon/Postgres-XL,edespino/gpdb,Postgres-XL/Postgres-XL,adam8157/gpdb,kmjungersen/PostgresXL,yazun/postgres-xl,jmcatamney/gpdb,greenplum-db/gpdb,zeroae/postgres-xl,kmjungersen/PostgresXL,postmind-net/postgres-xl,50wu/gpdb,adam8157/gpdb,oberstet/postgres-xl,Chibin/gpdb,ashwinstar/gpdb,xinzweb/gpdb,edespino/gpdb,adam8157/gpdb,edespino/gpdb,postmind-net/postgres-xl,zeroae/postgres-xl,50wu/gpdb,Chibin/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,techdragon/Postgres-XL,adam8157/gpdb,techdragon/Postgres-XL,pavanvd/postgres-xl,yuanzhao/gpdb,jmcatamney/gpdb,Chibin/gpdb,edespino/gpdb,lisakowen/gpdb,yuanzhao/gpdb,Chibin/gpdb,oberstet/postgres-xl,jmcatamney/gpdb,pavanvd/postgres-xl,ashwinstar/gpdb,50wu/gpdb,yuanzhao/gpdb,tpostgres-projects/tPostgres,postmind-net/postgres-xl,greenplum-db/gpdb,tpostgres-projects/tPostgres,yuanzhao/gpdb,arcivanov/postgres-xl,ovr/postgres-xl,xinzweb/gpdb,greenplum-db/gpdb,yazun/postgres-xl,edespino/gpdb,50wu/gpdb,xinzweb/gpdb,zeroae/postgres-xl,50wu/gpdb,greenplum-db/gpdb,Postgres-XL/Postgres-XL,snaga/postgres-xl,yazun/postgres-xl,arcivanov/postgres-xl,arcivanov/postgres-xl,oberstet/postgres-xl,zeroae/postgres-xl,snaga/postgres-xl,edespino/gpdb,ovr/postgres-xl,techdragon/Postgres-XL,jmcatamney/gpdb,lisakowen/gpdb,ashwinstar/gpdb,oberstet/postgres-xl,edespino/gpdb,Postgres-XL/Postgres-XL,xinzweb/gpdb,ashwinstar/gpdb,lisakowen/gpdb,yuanzhao/gpdb,Chibin/gpdb,50wu/gpdb,snaga/postgres-xl,ashwinstar/gpdb,arcivanov/postgres-xl,lisakowen/gpdb,pavanvd/postgres-xl,greenplum-db/gpdb,pavanvd/postgres-xl,Postgres-XL/Postgres-XL,arcivanov/postgres-xl,xinzweb/gpdb,ovr/postgres-xl,snaga/postgres-xl,adam8157/gpdb,kmjungersen/PostgresXL,tpostgres-projects/tPostgres,techdragon/Postgres-XL,yuanzhao/gpdb,arcivanov/postgres-xl,Chibin/gpdb,adam8157/gpdb,greenplum-db/gpdb,lisakowen/gpdb,ovr/postgres-xl,snaga/postgres-xl,lisakowen/gpdb,oberstet/postgres-xl,edespino/gpdb,kmjungersen/PostgresXL,Chibin/gpdb,xinzweb/gpdb,yuanzhao/gpdb,Chibin/gpdb,yazun/postgres-xl,yuanzhao/gpdb,xinzweb/gpdb,jmcatamney/gpdb