Fix panic when receiving malformed push promise with stream id 0

This commit is contained in:
Sean McArthur
2021-12-09 14:21:20 -08:00
parent 308663e71e
commit c876dda6d0

View File

@@ -400,6 +400,10 @@ impl PushPromise {
let flags = PushPromiseFlag(head.flag()); let flags = PushPromiseFlag(head.flag());
let mut pad = 0; let mut pad = 0;
if head.stream_id().is_zero() {
return Err(Error::InvalidStreamId);
}
// Read the padding length // Read the padding length
if flags.is_padded() { if flags.is_padded() {
if src.is_empty() { if src.is_empty() {