Add memory safety guard on SpdyHeaderBlock iterator
Add memory safety guard on SpdyHeaderBlock iterator

This CL  is the result of a multi-day investigation into a test crash. The test was the QUIC end-to-end test, and it had the following line:
EXPECT_EQ("200", client_->response_headers()->find(":status")->second);
Since response_headers() and find() are const, I had a hard time understanding why this line was corrupting memory. As it turns out, dereferencing a SpdyHeaderBlock::iterator actually modifies internal state in order to collapse all header fragments. Except if this is called on invalid memory, the collapsing can do significant damage. So in this test, if the response header did not contain the ":status" header, then it would corrupt memory.

This CL adds a mechanism to help detect this kind of bug, only in debug or asan builds. This CL does not modify behavior at all for opt builds, and does not modify behavior for well-formed programs in debug or asan.

The mechanism works by observing when the SpdyHeaderBlock is about to return an iterator that is out of bounds (equal to end()) , and setting a bool that will be checked on dereference.

This solution might be considered slightly overkill, but I really think it will save debugging time down the road.

Debug/asan-only change

PiperOrigin-RevId: 319248515
Change-Id: I2dc60b48efc97e4b3d1749c5bdae5d53de7cf48f

google/quiche,google/quiche,google/quiche,google/quiche