bugmake - Bugs: bug #45838, Memory corruption when recipe runs...

 
 

bug #45838: Memory corruption when recipe runs a batch file with spaces in path

Submitted by:  None
Submitted on:  Thu 27 Aug 2015 04:07:05 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: FixedPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 4.1Operating System: MS Windows
Fixed Release: 4.2Triage Status: Small Effort

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 23 Sep 2015 08:47:07 AM UTC, comment #2:

Thanks. Yes, this was because I misunderstood how memory is allocated for the argv[] array.

Now fixed the repository.

Eli Zaretskii <eliz>
Project Member
Thu 27 Aug 2015 07:21:48 PM UTC, comment #1:

I didn't realize you could post bugs without an account. I submitted that one.

Jérôme Vuarand <doub>
Thu 27 Aug 2015 04:07:05 PM UTC, original submission:

On 4.1, when trying to run a batch file from a recipe, and that batch file has a space in its path, strange command line corruption appears. The problem did not exist in 3.82.

I'm building make from sources on Windows with MSVC. I rebuilt in debug and ran the code through a debugger.

It turns out that the problem is in file sub_proc.c, in function process_begin, at line 725 (in 4.1 and current git head). The code wants to free argv[0] and replace it with something else. However all strings in argv are in a single memory block, so freeing argv[0] also frees subsequent argv[n] strings, and the memory doesn't always hold the argument content until they are used.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by eliz (Posted a comment)
  • -unavailable- added by doub (Posted a comment)
  •  

    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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 23 Sep 2015 08:47:07 AM UTCelizStatusNone=>Fixed
      Open/ClosedOpen=>Closed
      Fixed ReleaseNone=>4.2
      Triage StatusNone=>Small Effort
    Thu 27 Aug 2015 07:22:00 PM UTCdoubCarbon-CopyRemoved -unavailable-=>-
    Thu 27 Aug 2015 07:21:48 PM UTCdoubCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1