{"action":"opened","issue":{"url":"https://api.github.com/repos/scipy/scipy/issues/6143","repository_url":"https://api.github.com/repos/scipy/scipy","labels_url":"https://api.github.com/repos/scipy/scipy/issues/6143/labels{/name}","comments_url":"https://api.github.com/repos/scipy/scipy/issues/6143/comments","events_url":"https://api.github.com/repos/scipy/scipy/issues/6143/events","html_url":"https://github.com/scipy/scipy/issues/6143","id":153294971,"number":6143,"title":"segfault in linkage with incomplete data","user":{"login":"gregory-marton","id":5065456,"avatar_url":"https://avatars.githubusercontent.com/u/5065456?v=3","gravatar_id":"","url":"https://api.github.com/users/gregory-marton","html_url":"https://github.com/gregory-marton","followers_url":"https://api.github.com/users/gregory-marton/followers","following_url":"https://api.github.com/users/gregory-marton/following{/other_user}","gists_url":"https://api.github.com/users/gregory-marton/gists{/gist_id}","starred_url":"https://api.github.com/users/gregory-marton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregory-marton/subscriptions","organizations_url":"https://api.github.com/users/gregory-marton/orgs","repos_url":"https://api.github.com/users/gregory-marton/repos","events_url":"https://api.github.com/users/gregory-marton/events{/privacy}","received_events_url":"https://api.github.com/users/gregory-marton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-05T18:36:56Z","updated_at":"2016-05-05T18:36:56Z","closed_at":null,"body":"The following produces a nice heatmap:\r\n```\r\nimport pandas\r\ndf = pandas.DataFrame([['foo', 'foo', 1],\r\n                       ['foo', 'bar', 0],\r\n                       ['foo', 'caz', .2],\r\n                       ['bar', 'foo', 0],\r\n                       ['bar', 'bar', 1],\r\n                       ['bar', 'caz', .5],\r\n                       ['caz', 'foo', .2],\r\n                       ['caz', 'bar', .5],\r\n                       ['caz', 'caz', 1]])\r\nimport seaborn\r\nseaborn.clustermap(df, pivot_kws={'index': df.columns[0], \r\n                                  'columns': df.columns[1], \r\n                                  'values': df.columns[2]})\r\n```\r\n\r\nThe following produces a nice segfault:\r\n```\r\nimport pandas\r\ndf = pandas.DataFrame([['foo', 'foo', 1],\r\n                       ['foo', 'bar', 0],\r\n                       ['foo', 'caz', .2],\r\n#                       ['bar', 'foo', 0],\r\n                       ['bar', 'bar', 1],\r\n                       ['bar', 'caz', .5],\r\n                       ['caz', 'foo', .2],\r\n                       ['caz', 'bar', .5],\r\n                       ['caz', 'caz', 1]])\r\nimport seaborn\r\nseaborn.clustermap(df, pivot_kws={'index': df.columns[0], \r\n                                  'columns': df.columns[1], \r\n                                  'values': df.columns[2]})\r\n```\r\n\r\nCommenting out any subset of the complete square matrix above that doesn't trigger the too-few-elements guard causes a segfault. My gdb gave the following backtrace:\r\n```\r\n#0  0x00007fffe4f89110 in __pyx_pf_5scipy_7cluster_10_hierarchy_22linkage (__pyx_self=<optimized out>, __pyx_v_method=0, __pyx_v_n=2, \r\n    __pyx_v_Z=<optimized out>, __pyx_v_dists=...) at scipy/cluster/_hierarchy.c:8851\r\n#1  __pyx_pw_5scipy_7cluster_10_hierarchy_23linkage (__pyx_self=<optimized out>, __pyx_args=<optimized out>, __pyx_kwds=<optimized out>)\r\n    at scipy/cluster/_hierarchy.c:8519\r\n```"}}