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

 
 

bug #45247: Segfault with Corrupt Patch

Submitted by:  None
Submitted on:  Wed 03 Jun 2015 04:37:55 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

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 File(s):
   
   
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

 

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

Date Changed By Updated Field Previous Value => Replaced By
Wed 03 Jun 2015 04:37:55 PM UTCNoneAttached File-=>Added neg1, #34153
  Attached File-=>Added neg1.patch, #34154

Back to the top


Powered by Savane 3.1-cleanup1