File: cherry-pick.v2.9.4-6-gd9275da.fix-wsign-compare-warning.patch

package info (click to toggle)
http-parser 2.9.4-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,304 kB
  • sloc: ansic: 6,623; makefile: 130
file content (24 lines) | stat: -rw-r--r-- 934 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Subject: Fix -Wsign-compare warning
Origin: v2.9.4-6-gd9275da <https://github.com/joyent/http-parser/commit/d9275da>
Upstream-Author: Ben Noordhuis <info@bnoordhuis.nl>
Date: Fri May 15 13:29:49 2020 +0200

    The operands to `+` are promoted from `uint16_t` to `int` before
    addition, making the expression `off + len <= buflen` emit a
    warning because `buflen` is unsigned.

    Fixes: https://github.com/nodejs/http-parser/issues/514
    PR-URL: https://github.com/nodejs/http-parser/pull/515
    Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>

--- a/http_parser.c
+++ b/http_parser.c
@@ -2517,7 +2517,7 @@
     end = buf + off + len;
 
     /* NOTE: The characters are already validated and are in the [0-9] range */
-    assert(off + len <= buflen && "Port number overflow");
+    assert((size_t) (off + len) <= buflen && "Port number overflow");
     v = 0;
     for (p = buf + off; p < end; p++) {
       v *= 10;