bugGNU patch - Bugs: bug #45247, Segfault with Corrupt Patch

 
 

bug #45247: Segfault with Corrupt Patch

Submitter:  None
Submitted:  Wed 03 Jun 2015 04:37:55 PM UTC
   
 
Category:  Parser / Internal Representation Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 28 Jul 2019 02:36:13 PM UTC, comment #1: 

This segfault of this bug was fixed in version 2.7.6.  With that, patch still fails with the following message:

  patch: ** write error : Success

That was fixed by the followin gcommit from Bruno Haible:

  Fix check of return value of fwrite()

Andreas Gruenbacher <agruen>
Group administrator
Wed 03 Jun 2015 04:37:55 PM UTC, original submission:  

patch 2.7.5 and latest git master fail with a segfault when processing the attached corrupted neg1 file. I've attached a patch that at least prevents the segfault by checking if the given line is valid; it's not clear to me if other changes are necessary.

(gdb) r --dry-run < neg1
Starting program: /home/ned/dev/patch/src/patch --dry-run < neg1
can't find file to patch at input line 2
The text leading up to this was:
--------------------------
|---
--------------------------
File to patch: EOF
Skip this patch? [y] EOF
Skipping patch.

Program received signal SIGSEGV, Segmentation fault.
pch_write_line (line=line@entry=1, file=0x629ad0) at pch.c:2279
2279   bool after_newline = p_line[line][p_len[line] - 1] == '\n';

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #34153:  neg1 added by None (13B - application/octet-stream)
file #34154:  neg1.patch added by None (451B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by agruen (Updated the item)
  •  

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

    Date Changed by Updated Field Previous Value => Replaced by
    2019-07-28 agruen StatusNone Fixed
        Open/ClosedOpen Closed
    2019-07-28 agruen CategoryNone Parser / Internal Representation
    2015-06-03 None Attached File- Added neg1, #34153
        Attached File- Added neg1.patch, #34154

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code