cherry-pick.v2.9.4-6-gd9275da.fix-wsign-compare-warning.patch 934 B

123456789101112131415161718192021222324
  1. Subject: Fix -Wsign-compare warning
  2. Origin: v2.9.4-6-gd9275da <https://github.com/joyent/http-parser/commit/d9275da>
  3. Upstream-Author: Ben Noordhuis <info@bnoordhuis.nl>
  4. Date: Fri May 15 13:29:49 2020 +0200
  5. The operands to `+` are promoted from `uint16_t` to `int` before
  6. addition, making the expression `off + len <= buflen` emit a
  7. warning because `buflen` is unsigned.
  8. Fixes: https://github.com/nodejs/http-parser/issues/514
  9. PR-URL: https://github.com/nodejs/http-parser/pull/515
  10. Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
  11. --- a/http_parser.c
  12. +++ b/http_parser.c
  13. @@ -2517,7 +2517,7 @@
  14. end = buf + off + len;
  15. /* NOTE: The characters are already validated and are in the [0-9] range */
  16. - assert(off + len <= buflen && "Port number overflow");
  17. + assert((size_t) (off + len) <= buflen && "Port number overflow");
  18. v = 0;
  19. for (p = buf + off; p < end; p++) {
  20. v *= 10;