[torquedev] patch: qsub out of memory

Garrick Staples garrick at usc.edu
Mon Mar 13 13:00:33 MST 2006


On Fri, Mar 10, 2006 at 09:08:35PM -0700, Marcus R. Epperson alleged:
> Recently some of our resource_list lines have been too long for qsub 
> (2.0.0p7) to handle.  The error we see looks like this:
> 
> # qsub test.pbs
> qsub: out of memory
> 
> The problem shows up in qsub.c line 585.  'len' is assigned a negative 
> number and the subsequent malloc(len+1) call fails.  The root cause seems 
> to be that buffer[] overflows and corrupts the 'c' pointer which is used to 
> calculate len.
> 
> The attached patch fixes the problem by dynamically sizing buffer[] to the 
> size of line.  I think this is the "worst case" as far as the size 
> requirement for buffer[] goes, so it should eliminate the chance of 
> overflow.  I also added some assert statements to catch any more len <= 0 
> conditions, just in case. (better than calling malloc with a bogus value I 
> think)
> 
> It has worked for all of my test cases so far, but I haven't tested 
> extensively.
> 
> -Marcus

Excellent!  Feel free to fix up any other static buffers!

-- 
Garrick Staples, Linux/HPCC Administrator
University of Southern California
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.supercluster.org/pipermail/torquedev/attachments/20060313/a3b599ee/attachment.bin


More information about the torquedev mailing list