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


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

Submitter:  None
Submitted:  Thu 27 Aug 2015 04:07:05 PM UTC
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  4.1 Operating System:  MS Windows
Fixed Release:  4.2 Triage Status:  Small Effort
* Mandatory Fields

Add a New Comment Rich Markup

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>
Group 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.



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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-09-23 eliz StatusNone Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.2
        Triage StatusNone Small Effort
    2015-08-27 doub Carbon-CopyRemoved -email is unavailable- -
    2015-08-27 doub Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code