Commit 8a79453e authored by Bence Béky's avatar Bence Béky Committed by Commit Bot

Support fuzzing of SpdyHeadersIR and SpdyContinuationIR.

This CL lands server change 163977115 by diannahu.

BUG=488484

Change-Id: Iea6fd4a982db4cb3dbaf8e004a0e70e865f23550
Reviewed-on: https://chromium-review.googlesource.com/600247
Commit-Queue: Bence Béky <bnc@chromium.org>
Reviewed-by: default avatarHelen Li <xunjieli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491823}
parent 872164a1
...@@ -1407,8 +1407,7 @@ size_t SpdyFramer::GetNumberRequiredContinuationFrames(size_t size) { ...@@ -1407,8 +1407,7 @@ size_t SpdyFramer::GetNumberRequiredContinuationFrames(size_t size) {
return (overflow - 1) / payload_size + 1; return (overflow - 1) / payload_size + 1;
} }
size_t SpdyFramer::GetHeaderFrameSizeSansBlock( size_t SpdyFramer::GetHeaderFrameSizeSansBlock(const SpdyHeadersIR& header_ir) {
const SpdyHeadersIR& header_ir) const {
size_t min_size = kFrameHeaderSize; size_t min_size = kFrameHeaderSize;
if (header_ir.padded()) { if (header_ir.padded()) {
...@@ -1424,7 +1423,7 @@ size_t SpdyFramer::GetHeaderFrameSizeSansBlock( ...@@ -1424,7 +1423,7 @@ size_t SpdyFramer::GetHeaderFrameSizeSansBlock(
} }
size_t SpdyFramer::GetPushPromiseFrameSizeSansBlock( size_t SpdyFramer::GetPushPromiseFrameSizeSansBlock(
const SpdyPushPromiseIR& push_promise_ir) const { const SpdyPushPromiseIR& push_promise_ir) {
size_t size = kPushPromiseFrameMinimumSize; size_t size = kPushPromiseFrameMinimumSize;
if (push_promise_ir.padded()) { if (push_promise_ir.padded()) {
......
...@@ -335,6 +335,15 @@ class SPDY_EXPORT_PRIVATE SpdyFramer { ...@@ -335,6 +335,15 @@ class SPDY_EXPORT_PRIVATE SpdyFramer {
// Gets the serialized flags for the given |frame|. // Gets the serialized flags for the given |frame|.
static uint8_t GetSerializedFlags(const SpdyFrameIR& frame); static uint8_t GetSerializedFlags(const SpdyFrameIR& frame);
// Calculates the number of bytes required to serialize a SpdyHeadersIR, not
// including the bytes to be used for the encoded header set.
static size_t GetHeaderFrameSizeSansBlock(const SpdyHeadersIR& header_ir);
// Calculates the number of bytes required to serialize a SpdyPushPromiseIR,
// not including the bytes to be used for the encoded header set.
static size_t GetPushPromiseFrameSizeSansBlock(
const SpdyPushPromiseIR& push_promise_ir);
explicit SpdyFramer(CompressionOption option); explicit SpdyFramer(CompressionOption option);
virtual ~SpdyFramer(); virtual ~SpdyFramer();
...@@ -561,6 +570,9 @@ class SPDY_EXPORT_PRIVATE SpdyFramer { ...@@ -561,6 +570,9 @@ class SPDY_EXPORT_PRIVATE SpdyFramer {
void SetEncoderHeaderTableDebugVisitor( void SetEncoderHeaderTableDebugVisitor(
std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor); std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor);
// Get (and lazily initialize) the HPACK encoder state.
HpackEncoder* GetHpackEncoder();
void SetOverwriteLastFrame(bool value) { overwrite_last_frame_ = value; } void SetOverwriteLastFrame(bool value) { overwrite_last_frame_ = value; }
void SetIsLastFrame(bool value) { is_last_frame_ = value; } void SetIsLastFrame(bool value) { is_last_frame_ = value; }
bool ShouldOverwriteLastFrame() const { return overwrite_last_frame_; } bool ShouldOverwriteLastFrame() const { return overwrite_last_frame_; }
...@@ -693,9 +705,6 @@ class SPDY_EXPORT_PRIVATE SpdyFramer { ...@@ -693,9 +705,6 @@ class SPDY_EXPORT_PRIVATE SpdyFramer {
}; };
private: private:
// Get (and lazily initialize) the HPACK encoder state.
HpackEncoder* GetHpackEncoder();
size_t GetNumberRequiredContinuationFrames(size_t size); size_t GetNumberRequiredContinuationFrames(size_t size);
bool WritePayloadWithContinuation(SpdyFrameBuilder* builder, bool WritePayloadWithContinuation(SpdyFrameBuilder* builder,
...@@ -727,15 +736,6 @@ class SPDY_EXPORT_PRIVATE SpdyFramer { ...@@ -727,15 +736,6 @@ class SPDY_EXPORT_PRIVATE SpdyFramer {
const SpdyString& encoding, const SpdyString& encoding,
ZeroCopyOutputBuffer* output) const; ZeroCopyOutputBuffer* output) const;
// Calculates the number of bytes required to serialize a SpdyHeadersIR, not
// including the bytes to be used for the encoded header set.
size_t GetHeaderFrameSizeSansBlock(const SpdyHeadersIR& header_ir) const;
// Calculates the number of bytes required to serialize a SpdyPushPromiseIR,
// not including the bytes to be used for the encoded header set.
size_t GetPushPromiseFrameSizeSansBlock(
const SpdyPushPromiseIR& push_promise_ir) const;
// Serializes the flags octet for a given SpdyHeadersIR. // Serializes the flags octet for a given SpdyHeadersIR.
uint8_t SerializeHeaderFrameFlags(const SpdyHeadersIR& header_ir) const; uint8_t SerializeHeaderFrameFlags(const SpdyHeadersIR& header_ir) const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment