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

Re: MUMmer patches and Artistic license.



In <[🔎] 20090704120642.GH6047@kunpuu.plessy.org>, Charles Plessy wrote:
>we have a patch in the Debian package mummer for which we lost origin and
>detailed description. I would like to forward it upstream, but I would
> prefer to know what it does before ;) Would somebody have a few minutes
> to throw an eye on it?  It is in our SVN, and here is a copy:
>
>http://svn.debian.org/wsvn/debian-med/trunk/packages/mummer/trunk/debian/p
>atches/01sm_src_tigr.diff
>
>+   assert ( D_buf  = (int  *) calloc ( (M+1)*(N+1), sizeof(int) ) ) ;
>+   D  = &D_buf ;
>+   assert ( Op_buf = (char *) calloc ( (M+1)*(N+1), sizeof(char) ) ) ;
>+   Op = &Op_buf ;
>+   assert ( Show_A = (char *) calloc ( 2*(M+1) , sizeof(char) ) ) ;
>+   assert ( Show_B = (char *) calloc ( 2*(N+1) , sizeof(char) ) ) ;

Four out of these six lines are bugs waiting to happen.  If NDEBUG is 
defined, the calls to calloc will be completely elided.  Then you'll have a 
number of uninitialized pointers that are used here:

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

This patch is a good idea -- fixed length buffers are rarely considered 
user-friendly.  However, it is executed poorly; it's not ready for upstream 
in its current state.
-- 
Boyd Stephen Smith Jr.           	 ,= ,-_-. =.
bss@iguanasuicide.net            	((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy 	 `-'(. .)`-'
http://iguanasuicide.net/        	     \_/

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: