Skip to content

Commit f9e7750

Browse files
author
Linus Torvalds
committed
Fix SIGSEGV on unmerged files in git-diff-files -p
NULL is not considered a VALID pathspec.
1 parent 7d95ee9 commit f9e7750

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

diffcore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct diff_filespec {
3333
* if false, use the name and read from
3434
* the filesystem.
3535
*/
36-
#define DIFF_FILE_VALID(spec) (((spec)->mode) != 0)
36+
#define DIFF_FILE_VALID(spec) ((spec) && ((spec)->mode) != 0)
3737
unsigned should_free : 1; /* data should be free()'ed */
3838
unsigned should_munmap : 1; /* data should be munmap()'ed */
3939
};

0 commit comments

Comments
 (0)