go.net/spdy: disallow stream id 0
Per 2.3.2 of draft-mbelshe-httpbis-spdy-00.
R=mikioh.mikioh, bradfitz
CC=adg, golang-dev
https://golang.org/cl/6781053
diff --git a/spdy/read.go b/spdy/read.go
index a23af24..857f915 100644
--- a/spdy/read.go
+++ b/spdy/read.go
@@ -28,6 +28,9 @@
if err := binary.Read(f.r, binary.BigEndian, &frame.Status); err != nil {
return err
}
+ if frame.StreamId == 0 {
+ return &Error{ZeroStreamId, 0}
+ }
return nil
}
@@ -61,6 +64,9 @@
if err := binary.Read(f.r, binary.BigEndian, &frame.Id); err != nil {
return err
}
+ if frame.Id == 0 {
+ return &Error{ZeroStreamId, 0}
+ }
return nil
}
@@ -222,6 +228,9 @@
}
}
}
+ if frame.StreamId == 0 {
+ return &Error{ZeroStreamId, 0}
+ }
return nil
}
@@ -258,6 +267,9 @@
}
}
}
+ if frame.StreamId == 0 {
+ return &Error{ZeroStreamId, 0}
+ }
return nil
}
@@ -301,6 +313,9 @@
}
}
}
+ if frame.StreamId == 0 {
+ return &Error{ZeroStreamId, 0}
+ }
return nil
}
@@ -317,5 +332,8 @@
if _, err := io.ReadFull(f.r, frame.Data); err != nil {
return nil, err
}
+ if frame.StreamId == 0 {
+ return nil, &Error{ZeroStreamId, 0}
+ }
return &frame, nil
}