fork of go-gitdiff with jj support
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix out-of-bounds panic parsing timestamps (#28)

Found by go-fuzz.

authored by

Billy Keyes and committed by
GitHub
b6a90110 53bcdf7e

+9 -1
+1 -1
gitdiff/file_header.go
··· 527 528 // a valid timestamp can have optional ':' in zone specifier 529 // remove that if it exists so we have a single format 530 - if ts[len(ts)-3] == ':' { 531 ts = ts[:len(ts)-3] + ts[len(ts)-2:] 532 } 533
··· 527 528 // a valid timestamp can have optional ':' in zone specifier 529 // remove that if it exists so we have a single format 530 + if len(ts) >= 3 && ts[len(ts)-3] == ':' { 531 ts = ts[:len(ts)-3] + ts[len(ts)-2:] 532 } 533
+8
gitdiff/file_header_test.go
··· 724 Input: "+++ file.txt\t2019-03-21 12:34:56.789 -0700\n", 725 Output: false, 726 }, 727 } 728 729 for name, test := range tests {
··· 724 Input: "+++ file.txt\t2019-03-21 12:34:56.789 -0700\n", 725 Output: false, 726 }, 727 + "notTimestamp": { 728 + Input: "+++ file.txt\trandom text\n", 729 + Output: false, 730 + }, 731 + "notTimestampShort": { 732 + Input: "+++ file.txt\t0\n", 733 + Output: false, 734 + }, 735 } 736 737 for name, test := range tests {