[master] d708fe0 Please flexelint, pl can be unsigned

Guillaume Quintard guillaume at varnish-software.com
Thu Sep 8 12:22:12 CEST 2016


commit d708fe048c85351bec1ba42a71388b45e4896e85
Author: Guillaume Quintard <guillaume at varnish-software.com>
Date:   Thu Sep 8 11:47:35 2016 +0200

    Please flexelint, pl can be unsigned

diff --git a/bin/varnishtest/vtc_h2_hpack.c b/bin/varnishtest/vtc_h2_hpack.c
index a378966..1239816 100644
--- a/bin/varnishtest/vtc_h2_hpack.c
+++ b/bin/varnishtest/vtc_h2_hpack.c
@@ -57,13 +57,12 @@ huff_decode(char *str, int nm, struct hpk_iter *iter, int ilen)
 {
 	int l = 0;
 	uint64_t pack = 0;
-	int pl = 0; /* pack length*/
+	unsigned pl = 0; /* pack length*/
 	struct stbl *tbl = &byte0;
 	struct ssym *sym;
 
 	(void)nm;
 	while (ilen > 0 || pl != 0) {
-		assert(pl >= 0);
 		/* make sure we have enough data*/
 		if (pl < tbl->msk) {
 			if (ilen == 0) {
@@ -92,6 +91,7 @@ huff_decode(char *str, int nm, struct hpk_iter *iter, int ilen)
 			return (0);
 
 		pack <<= sym->csm;
+		assert(sym->csm <= pl);
 		pl -= sym->csm;
 		if (sym->nxt) {
 			tbl = sym->nxt;



More information about the varnish-commit mailing list