r.checksum.reset()
}
- if descriptor&3 != 0 {
- return r.makeError(relativeOffset, "dictionaries are not supported")
+ // Dictionary_ID_Flag. RFC 3.1.1.1.1.6.
+ dictionaryIdSize := 0
+ if dictIdFlag := descriptor & 3; dictIdFlag != 0 {
+ dictionaryIdSize = 1 << (dictIdFlag - 1)
}
relativeOffset++
- headerSize := windowDescriptorSize + fcsFieldSize
+ headerSize := windowDescriptorSize + dictionaryIdSize + fcsFieldSize
if _, err := io.ReadFull(r.r, r.scratch[:headerSize]); err != nil {
return r.wrapNonEOFError(relativeOffset, err)
}
}
- // Frame_Content_Size. RFC 3.1.1.4.
+ // Dictionary_ID. RFC 3.1.1.1.3.
+ if dictionaryIdSize != 0 {
+ dictionaryId := r.scratch[windowDescriptorSize : windowDescriptorSize+dictionaryIdSize]
+ // Allow only zero Dictionary ID.
+ for _, b := range dictionaryId {
+ if b != 0 {
+ return r.makeError(relativeOffset, "dictionaries are not supported")
+ }
+ }
+ }
+
+ // Frame_Content_Size. RFC 3.1.1.1.4.
r.frameSizeUnknown = false
r.remainingFrameSize = 0
- fb := r.scratch[windowDescriptorSize:]
+ fb := r.scratch[windowDescriptorSize+dictionaryIdSize:]
switch fcsFieldSize {
case 0:
r.frameSizeUnknown = true