Avoid possibly accessing off the end of memory in examine_attribute().
Avoid possibly accessing off the end of memory in examine_attribute().

Since the last couple of columns of pg_type are often NULL,
sizeof(FormData_pg_type) can be an overestimate of the actual size of the
tuple data part.  Therefore memcpy'ing that much out of the catalog cache,
as analyze.c was doing, poses a small risk of copying past the end of
memory and incurring SIGSEGV.  No such crash has been identified in the
field, but we've certainly seen the equivalent happen in other code paths,
so patch this one all the way back.

Per valgrind testing by Noah Misch, though this is not his proposed patch.
I chose to use SearchSysCacheCopy1 rather than inventing special-purpose
infrastructure for copying only the minimal part of a pg_type tuple.

ahachete/gpdb,greenplum-db/gpdb,0x0FFF/gpdb,kaknikhil/gpdb,zaksoup/gpdb,zaksoup/gpdb,lintzc/gpdb,adam8157/gpdb,janebeckman/gpdb,edespino/gpdb,lintzc/gpdb,greenplum-db/gpdb,xinzweb/gpdb,royc1/gpdb,janebeckman/gpdb,ashwinstar/gpdb,edespino/gpdb,jmcatamney/gpdb,cjcjameson/gpdb,Quikling/gpdb,ashwinstar/gpdb,CraigHarris/gpdb,Quikling/gpdb,greenplum-db/gpdb,edespino/gpdb,50wu/gpdb,xuegang/gpdb,lintzc/gpdb,0x0FFF/gpdb,zaksoup/gpdb,yuanzhao/gpdb,Chibin/gpdb,janebeckman/gpdb,yuanzhao/gpdb,yuanzhao/gpdb,ahachete/gpdb,royc1/gpdb,Chibin/gpdb,lisakowen/gpdb,ahachete/gpdb,CraigHarris/gpdb,yuanzhao/gpdb,50wu/gpdb,edespino/gpdb,cjcjameson/gpdb,ashwinstar/gpdb,zaksoup/gpdb,edespino/gpdb,xuegang/gpdb,xuegang/gpdb,zaksoup/gpdb,ahachete/gpdb,50wu/gpdb,CraigHarris/gpdb,adam8157/gpdb,lisakowen/gpdb,cjcjameson/gpdb,Quikling/gpdb,adam8157/gpdb,greenplum-db/gpdb,xuegang/gpdb,kaknikhil/gpdb,chrishajas/gpdb,CraigHarris/gpdb,kaknikhil/gpdb,ahachete/gpdb,janebeckman/gpdb,royc1/gpdb,greenplum-db/gpdb,chrishajas/gpdb,lisakowen/gpdb,lintzc/gpdb,lintzc/gpdb,CraigHarris/gpdb,50wu/gpdb,Quikling/gpdb,rvs/gpdb,lisakowen/gpdb,Chibin/gpdb,royc1/gpdb,adam8157/gpdb,jmcatamney/gpdb,0x0FFF/gpdb,CraigHarris/gpdb,kaknikhil/gpdb,cjcjameson/gpdb,ashwinstar/gpdb,xuegang/gpdb,Chibin/gpdb,rvs/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,kaknikhil/gpdb,ashwinstar/gpdb,0x0FFF/gpdb,50wu/gpdb,cjcjameson/gpdb,xuegang/gpdb,Quikling/gpdb,cjcjameson/gpdb,zaksoup/gpdb,cjcjameson/gpdb,xinzweb/gpdb,yuanzhao/gpdb,ashwinstar/gpdb,royc1/gpdb,50wu/gpdb,greenplum-db/gpdb,CraigHarris/gpdb,jmcatamney/gpdb,lisakowen/gpdb,rvs/gpdb,xuegang/gpdb,janebeckman/gpdb,kaknikhil/gpdb,kaknikhil/gpdb,adam8157/gpdb,royc1/gpdb,chrishajas/gpdb,rvs/gpdb,jmcatamney/gpdb,edespino/gpdb,lisakowen/gpdb,Quikling/gpdb,rvs/gpdb,0x0FFF/gpdb,edespino/gpdb,0x0FFF/gpdb,janebeckman/gpdb,cjcjameson/gpdb,50wu/gpdb,lintzc/gpdb,ashwinstar/gpdb,janebeckman/gpdb,cjcjameson/gpdb,kaknikhil/gpdb,lintzc/gpdb,lintzc/gpdb,Chibin/gpdb,Quikling/gpdb,edespino/gpdb,xuegang/gpdb,royc1/gpdb,adam8157/gpdb,janebeckman/gpdb,royc1/gpdb,Chibin/gpdb,janebeckman/gpdb,0x0FFF/gpdb,Chibin/gpdb,ashwinstar/gpdb,rvs/gpdb,adam8157/gpdb,chrishajas/gpdb,chrishajas/gpdb,zaksoup/gpdb,xinzweb/gpdb,edespino/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,xuegang/gpdb,chrishajas/gpdb,Quikling/gpdb,xinzweb/gpdb,rvs/gpdb,Chibin/gpdb,50wu/gpdb,xinzweb/gpdb,rvs/gpdb,lisakowen/gpdb,Chibin/gpdb,janebeckman/gpdb,adam8157/gpdb,yuanzhao/gpdb,ahachete/gpdb,0x0FFF/gpdb,yuanzhao/gpdb,ahachete/gpdb,Quikling/gpdb,jmcatamney/gpdb,jmcatamney/gpdb,yuanzhao/gpdb,Chibin/gpdb,cjcjameson/gpdb,edespino/gpdb,kaknikhil/gpdb,xinzweb/gpdb,chrishajas/gpdb,CraigHarris/gpdb,zaksoup/gpdb,chrishajas/gpdb,ahachete/gpdb,xinzweb/gpdb,lintzc/gpdb,yuanzhao/gpdb,CraigHarris/gpdb,rvs/gpdb,lisakowen/gpdb,kaknikhil/gpdb,Quikling/gpdb,rvs/gpdb,yuanzhao/gpdb,xinzweb/gpdb