Add some checks.
GitOrigin-RevId: 6c24e7d3d48ed823a45d6b106855f3a0f55a0db5
This commit is contained in:
parent
4c80155092
commit
088a96ff15
@ -148,6 +148,7 @@ Result<size_t> HttpReader::read_next(HttpQuery *query) {
|
||||
end_p--;
|
||||
}
|
||||
|
||||
CHECK(p != nullptr);
|
||||
Slice boundary(p, static_cast<size_t>(end_p - p));
|
||||
if (boundary.empty() || boundary.size() > MAX_BOUNDARY_LENGTH) {
|
||||
return Status::Error(400, "Bad Request: boundary too big or empty");
|
||||
|
@ -515,6 +515,7 @@ int strm_read(BIO *b, char *buf, int len) {
|
||||
auto *stream = static_cast<SslStreamImpl *>(BIO_get_data(b));
|
||||
CHECK(stream != nullptr);
|
||||
BIO_clear_retry_flags(b);
|
||||
CHECK(buf != nullptr);
|
||||
int res = narrow_cast<int>(stream->flow_read(MutableSlice(buf, len)));
|
||||
if (res == 0) {
|
||||
BIO_set_retry_read(b);
|
||||
@ -526,6 +527,7 @@ int strm_write(BIO *b, const char *buf, int len) {
|
||||
auto *stream = static_cast<SslStreamImpl *>(BIO_get_data(b));
|
||||
CHECK(stream != nullptr);
|
||||
BIO_clear_retry_flags(b);
|
||||
CHECK(buf != nullptr);
|
||||
return narrow_cast<int>(stream->flow_write(Slice(buf, len)));
|
||||
}
|
||||
} // namespace
|
||||
|
@ -45,7 +45,7 @@ class ParserImpl {
|
||||
return ptr_ == end_;
|
||||
}
|
||||
void clear() {
|
||||
ptr_ = nullptr;
|
||||
ptr_ = SliceT().begin();
|
||||
end_ = ptr_;
|
||||
status_ = Status::OK();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user