bugmake - Bugs: bug #10176, Asking negative value of memory...

 
 

bug #10176: Asking negative value of memory due to wrong pointer ariphmetic

Submitted by:  None
Submitted on:  Fri 27 Aug 2004 01:58:17 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: DuplicatePrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.80Operating System: MS Windows
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 27 Aug 2004 02:56:57 PM UTC, comment #1:

This is a duplicate of bug # 1517. See that bug report for a patch to fix it.

Paul D. Smith <psmith>
Project Administrator
Fri 27 Aug 2004 01:58:17 PM UTC, original submission:

I've met an issue using make for my project - make just prints
make: *** virtual memory exhausted. Stop.
and exits.
I've attached the project tree with makefiles, to reproduce you must just type make in 'bug' directory.

I've needed to have the problem fixed quckly so I did some debugging - it turns out variable_buffer_output(..) function in expand.c requires to allocate 0xffffea9d bytes of

memory that is just negative value. This negative value appears because newlen is calculated in the beginning of function as:
register unsigned int newlen = length + (ptr - variable_buffer);

Ptr is value from outer function, variable_buffer is a module static variable.
In the outer function variable_expand_string there is a loop: o (which is passed as ptr) is actually a pointer to substring inside variable_buffer. In this light doing (ptr - variable_buffer) is ok, it is offset of substring in the string, but variable_buffer is a static variable and other functions change it during loop iteration, particularly handle_function(). So after few loop iterations (ptr - variable_buffer) is no longer offset of substring in the string, but rather an invalid value. That's how newlen becomes negative.

If you have problems reproducing the problem or have another questions - contact me via SlavaSysoltsev@mail.ru.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #1683:  bug.tgz added by None (10KiB - application/x-gzip-compressed - Directory tree with makefiles)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Fri 27 Aug 2004 02:56:57 PM UTCpsmithStatusNone=>Duplicate
  Open/ClosedOpen=>Closed
Fri 27 Aug 2004 01:58:17 PM UTCNoneAttached File-=>Added bug.tgz, #1612

Back to the top


Powered by Savane 3.1-cleanup1