Add test for the bug that shift goes beyond 32 bits in decode_length

This commit is contained in:
Tatsuhiro Tsujikawa 2016-11-12 23:05:16 +09:00
parent 0aa35e574a
commit 8e52a5c7f3
1 changed files with 13 additions and 0 deletions

View File

@ -1492,6 +1492,19 @@ void test_nghttp2_hd_decode_length(void) {
rv = nghttp2_hd_decode_length(&out, &shift, &fin, 0, 0, buf, buf + len, 7); rv = nghttp2_hd_decode_length(&out, &shift, &fin, 0, 0, buf, buf + len, 7);
CU_ASSERT(-1 == rv); CU_ASSERT(-1 == rv);
/* Check the case that shift goes beyond 32 bits */
buf[0] = 255;
buf[1] = 128;
buf[2] = 128;
buf[3] = 128;
buf[4] = 128;
buf[5] = 128;
buf[6] = 1;
rv = nghttp2_hd_decode_length(&out, &shift, &fin, 0, 0, buf, buf + 7, 8);
CU_ASSERT(-1 == rv);
} }
void test_nghttp2_hd_huff_encode(void) { void test_nghttp2_hd_huff_encode(void) {