Bug 7916 - patch command seg faults on malformed patch
Summary: patch command seg faults on malformed patch
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.22.x
Hardware: PC Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-10 23:12 UTC by Jim Keniston
Modified: 2015-03-11 17:09 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
suggested fix (1.31 KB, patch)
2015-03-10 23:12 UTC, Jim Keniston
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Keniston 2015-03-10 23:12:36 UTC
Created attachment 5916 [details]
suggested fix

The patch applet dies with a SEGV when presented with the following corrupted patch.  (Note the missing hyphen on line 1.)
-- dwarves.orig 2015-02-25 01:45:27.753000000 +0000
+++ dwarves     2015-02-25 01:46:08.199000000 +0000
@@ -1,7 +1,7 @@
 Bashful
 Doc
 Dopey
-Grouchy
+Grumpy
 Happy
 Sleepy
 Sneezy

For comparison, GNU patch silently does what's apparently wanted, based on the "+++" line.

The attached patch fixes this bug.
Comment 1 Denys Vlasenko 2015-03-11 17:09:38 UTC
Fixed in git. Thanks!