From: Carsten Kutzner Date: Fri, 26 Aug 2011 14:05:41 +0000 (+0200) Subject: Remove segv in xpm2ps, fixes #611 X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=0cad407c08418d8968f4bc22646a3e18892a81f0;p=alexxy%2Fgromacs.git Remove segv in xpm2ps, fixes #611 Issue a fatal error if matrix elements are to be added/subtracted/multiplied/divided (with xpm2ps -compine) but no proper matrix data could be extracted from one of the xpm files. --- diff --git a/src/tools/gmx_xpm2ps.c b/src/tools/gmx_xpm2ps.c index fb057f4a33..317a736c5e 100644 --- a/src/tools/gmx_xpm2ps.c +++ b/src/tools/gmx_xpm2ps.c @@ -941,6 +941,12 @@ void write_combined_matrix(int ecombine, const char *fn, printf("Combining two %dx%d matrices\n",mat1[k].nx,mat1[k].ny); rmat1 = matrix2real(&mat1[k], NULL); rmat2 = matrix2real(&mat2[k], NULL); + if (NULL == rmat1 || NULL == rmat2) + { + gmx_fatal(FARGS, "Could not extract real data from %s xpm matrices. Note that, e.g.,\n" + "g_rms and g_mdmat provide such data, but not do_dssp.\n", + (NULL==rmat1 && NULL==rmat2) ? "both" : "one of the" ); + } rlo=1e38; rhi=-1e38; for(j=0; j