Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash when GetAllChildren returns nil,nil
When GetAllChildren return nil, nil the following panic happens panic: runtime error: makeslice: cap out of range goroutine 1 [running]: iso9660.(*File).GetChildren(0x54ec60?) /home/tzachmann/develop/test/go/iso9660/src/iso9660/image_reader.go:254 +0x51 Here is the code that is problematic. When GetAllChildren returns nil, nil make with a size of -2 will be called which results in the above panic. func (f *File) GetChildren() ([]*File, error) { children, err := f.GetAllChildren() if err != nil { return nil, err } filteredChildren := make([]*File, 0, len(children)-2) This patch returns an error in case there are no children or the ReadAt fails. If in this cases a nil, nil is fine the above code could be changed to filteredChildren := make([]*File, 0, len(children)) to fix the problem.
- Loading branch information