bugmake - Bugs: bug #58497, inconsistent newline removal in...


bug #58497: inconsistent newline removal in $(file <)

Submitted by:  Ken Tossell <kennyt>
Submitted on:  Thu 04 Jun 2020 02:06:36 PM UTC  
Severity:  3 - Normal Item Group:  Bug
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  4.3 Operating System:  Any
Fixed Release:  None Triage Status:  None

Add a New Comment (Rich Markup)

You are not logged in

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


Mon 08 Jun 2020 02:47:38 AM UTC, comment #2: 

However, i'd like to be able to reproduce realloc returning a smaller address.
Ken, do you have a makefile which reproduces this?

Dmitry Goncharov <dgoncharov>
Mon 08 Jun 2020 02:45:57 AM UTC, comment #1: 

Attached another fix along with new tests.

Dmitry Goncharov <dgoncharov>
Thu 04 Jun 2020 02:06:36 PM UTC, original submission:  

Within $(file <), the output variable's string buffer can get reallocated, potentially being moved to a smaller address than the one it started with.

At the end of this function, the code looks for a final newline to strip, but only if at least one character has been read.

In order to determine whether a character was read, the code tests whether the pointer into the buffer has increased, and this is not the case if the buffer was reallocated to a smaller address.

Ken Tossell <kennyt>


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

Attach Files:


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by dgoncharov (Updated the item)
  • -email is unavailable- added by kennyt (Submitted the item)

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

    Only logged-in users can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-06-08 dgoncharov Attached File- => Added sv_58497_fix_function_file.diff, #49224
        Attached File- => Added sv_58497_fix_function_file_tests.diff, #49225
    2020-06-04 kennyt Attached File- => Added 0001-src-function.c-func_file-fix-inconsistent-newline-re.patch, #49212

    Back to the top

    Powered by Savane 3.5