[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [MUMmer-help] MUMmer patch for dynamic memory allocation.



Le Thu, Jul 30, 2009 at 03:25:53PM -0400, Adam Phillippy a écrit :
>    This patch looks fine. I saw it awhile back, but it got lost in the
>    shuffle and was never applied.  I'm on vacation right now, but I'll apply
>    it to our distribution when I return.

Thank you very much. In the meantime, an improved version was prepared by Boyd
Stephen Smith Jr. I updated our subversion repository accordingly, and you can
retreive it with the following link:

http://svn.debian.org/wsvn/debian-med/trunk/packages/mummer/trunk/debian/patches/01sm_src_tigr.diff

The difference with the previous patch is the following:

    int  Errors, Tmp;
    long int  i, j, Ct;

-   assert ( D_buf  = (int  *) calloc ( (M+1)*(N+1), sizeof(int) ) ) ;
+   assert ( SIZE_MAX / (M+1) >= (N+1) ) ;
+   D_buf  = (int  *) calloc ( (M+1)*(N+1), sizeof(int) ) ;
+   assert ( D_buf ) ;
    D  = &D_buf ;
-   assert ( Op_buf = (char *) calloc ( (M+1)*(N+1), sizeof(char) ) ) ;
+   Op_buf = (char *) calloc ( (M+1)*(N+1), sizeof(char) ) ;
+   assert ( Op_buf ) ;
    Op = &Op_buf ;
-   assert ( Show_A = (char *) calloc ( 2*(M+1) , sizeof(char) ) ) ;
-   assert ( Show_B = (char *) calloc ( 2*(N+1) , sizeof(char) ) ) ;
+
+   assert ( SIZE_MAX >> 1 >= (M+1) ) ;
+   Show_A = (char *) calloc ( 2*(M+1) , sizeof(char) ) ;
+   assert ( Show_A ) ;
+   Show_B = (char *) calloc ( 2*(N+1) , sizeof(char) ) ;
+   assert ( Show_B ) ;

    D [0] [0] = 0;
    Op [0] [0] = 'a';

Have a nice vacation !

-- 
Charles Plessy
Debian Med packaging team,
http://www.debian.org/devel/debian-med
Tsurumi, Kanagawa, Japan


Reply to: