goexif: fix crash observed in the wild.

Reported by ajft@ajft.org

Change-Id: I4d4ddc998bb07f75d484341b8e423151d6c1aaa0
This commit is contained in:
Brad Fitzpatrick 2013-08-05 07:51:53 -07:00
parent 0dea7eae9b
commit 02a95a503d
1 changed files with 3 additions and 1 deletions

View File

@ -114,7 +114,9 @@ func (t *Tag) convertVals() {
switch t.Fmt {
case 2: // ascii string
t.strVal = string(t.Val[:len(t.Val)-1])
if len(t.Val) > 0 {
t.strVal = string(t.Val[:len(t.Val)-1])
}
case 1:
var v uint8
t.intVals = make([]int64, int(t.Ncomp))