Do not call memcpy with nullptr in SimpleBuffer::Read() and Write().

"If either dest or src is an invalid or null pointer, the behavior is undefined,
even if count is zero" according to
https://en.cppreference.com/w/cpp/string/byte/memcpy.

In Write(), if `size` is positive, then Reserve() guarantees that destination
will never be nullptr.  If source is nullptr and `size` is zero, then the newly
added early return prevents the memcpy call.  If source is nullptr and `size` is
not zero, that is the caller's fault.

In Read(), if `bytes` is nullptr and `size` is zero, then a newly added early
return prevents the memcpy call.  If `bytes` is nullptr and `size` is not zero,
that is the caller's fault.  If `read_ptr` is nullptr, then `read_size` will be
zero, triggering the newly added early return path.

This is covered by existing tests in UBSAN mode, which are never actually ran in
UBSAN mode, but will be on Envoy CI soon.

PiperOrigin-RevId: 449057984
1 file changed
tree: 6df9396c4092760f15e50dbc74cdf6ac30ac79cb
  1. build/
  2. quiche/
  3. CONTRIBUTING.md
  4. LICENSE
  5. README.md
  6. WHITESPACE
README.md

QUICHE

QUICHE stands for QUIC, Http, Etc. It is Google‘s production-ready implementation of QUIC, HTTP/2, HTTP/3, and related protocols and tools. It powers Google’s servers, Chromium, Envoy, and other projects. It is actively developed and maintained.

There are two public QUICHE repositories. Either one may be used by embedders, as they are automatically kept in sync:

To embed QUICHE in your project, platform APIs need to be implemented and build files need to be created. Note that it is on the QUICHE team's roadmap to include default implementation for all platform APIs and to open-source build files. In the meanwhile, take a look at open source embedders like Chromium and Envoy to get started:

To contribute to QUICHE, follow instructions at CONTRIBUTING.md.

QUICHE is only supported on little-endian platforms.