fix ubsan errors

Signed-off-by: Asra Ali <asraa@google.com>
This commit is contained in:
Asra Ali 2020-05-18 17:07:38 -04:00 committed by Tatsuhiro Tsujikawa
parent ec084acdba
commit 78a56cf66f
2 changed files with 8 additions and 4 deletions

View File

@ -82,8 +82,10 @@ void nghttp2_buf_reset(nghttp2_buf *buf) {
}
void nghttp2_buf_wrap_init(nghttp2_buf *buf, uint8_t *begin, size_t len) {
buf->begin = buf->pos = buf->last = buf->mark = begin;
buf->end = begin + len;
buf->begin = buf->pos = buf->last = buf->mark = buf->end = begin;
if (len) {
buf->end += len;
}
}
static int buf_chain_new(nghttp2_buf_chain **chain, size_t chunk_length,

View File

@ -818,8 +818,10 @@ int nghttp2_frame_unpack_origin_payload(nghttp2_extension *frame,
size_t len = 0;
origin = frame->payload;
p = payload;
end = p + payloadlen;
p = end = payload;
if (payloadlen) {
end += payloadlen;
}
for (; p != end;) {
if (end - p < 2) {