os: check for valid arguments in windows Readdir

Fixes #1129.

R=rsc, brainman
CC=Joe Poirier, golang-dev
https://golang.org/cl/2211045
diff --git a/src/pkg/os/file_windows.go b/src/pkg/os/file_windows.go
index 658e9c8..cee3aad 100644
--- a/src/pkg/os/file_windows.go
+++ b/src/pkg/os/file_windows.go
@@ -113,6 +113,12 @@
 // A negative count means to read until EOF.
 // Readdir returns the array and an Error, if any.
 func (file *File) Readdir(count int) (fi []FileInfo, err Error) {
+	if file == nil || file.fd < 0 {
+		return nil, EINVAL
+	}
+	if !file.isdir() {
+		return nil, &PathError{"Readdir", file.name, ENOTDIR}
+	}
 	di := file.dirinfo
 	size := count
 	if size < 0 {