modules/metadata/mod_remoteip.c:1100: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `remoteip_process_v1_header`.

modules/metadata/mod_remoteip.c:1011:1: Parameter `f->ctx->need`
1009.  * Removes itself when the header is complete.
1010.  */
1011. static apr_status_t remoteip_input_filter(ap_filter_t *f,
      ^
1012.                                     apr_bucket_brigade *bb_out,
1013.                                     ap_input_mode_t mode,

modules/metadata/mod_remoteip.c:1075:13: Assignment
1073. 
1074.             memcpy(ctx->header + ctx->rcvd, ptr, len);
1075.             ctx->rcvd += len;
                  ^
1076. 
1077.             /* Remove instead of delete - we may put this bucket

modules/metadata/mod_remoteip.c:1100:24: Call
1098.             }
1099.             else if (ctx->version == 1) {
1100.                 psts = remoteip_process_v1_header(f->c, conn_conf,
                             ^
1101.                                             (proxy_header *) ctx->header,
1102.                                             ctx->rcvd, &ctx->need);

modules/metadata/mod_remoteip.c:747:1: <LHS trace>
745.  * PROXY {TCP4|TCP6|UNKNOWN} <client-ip-addr> <dest-ip-addr> <client-port> <dest-port><CR><LF>
746.  */
747. static remoteip_parse_status_t remoteip_process_v1_header(conn_rec *c,
     ^
748.                                                           remoteip_conn_config_t *conn_conf,
749.                                                           proxy_header *hdr, apr_size_t len,

modules/metadata/mod_remoteip.c:747:1: Parameter `len`
  745.  * PROXY {TCP4|TCP6|UNKNOWN} <client-ip-addr> <dest-ip-addr> <client-port> <dest-port><CR><LF>
  746.  */
  747. static remoteip_parse_status_t remoteip_process_v1_header(conn_rec *c,
       ^
  748.                                                           remoteip_conn_config_t *conn_conf,
  749.                                                           proxy_header *hdr, apr_size_t len,

modules/metadata/mod_remoteip.c:767:11: Binary operation: ([0, +oo] - 1):unsigned64 by call to `remoteip_process_v1_header` 
  765.     }
  766. 
  767.     end = memchr(hdr->v1.line, '\r', len - 1);
                 ^
  768.     if (!end || end[1] != '\n') {
  769.         return HDR_NEED_MORE; /* partial or invalid header */

static remoteip_parse_status_t remoteip_process_v1_header(conn_rec *c,
                                                          remoteip_conn_config_t *conn_conf,
                                                          proxy_header *hdr, apr_size_t len,
                                                          apr_size_t *hdr_len)
{
    char *end, *word, *host, *valid_addr_chars, *saveptr;
    char buf[sizeof(hdr->v1.line)];
    apr_port_t port;
    apr_status_t ret;
    apr_int32_t family;
#define GET_NEXT_WORD(field) \
    word = apr_strtok(NULL, " ", &saveptr); \
    if (!word) { \
        ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(03497) \
                      "RemoteIPProxyProtocol: no " field " found in header '%s'", \
                      hdr->v1.line); \
        return HDR_ERROR; \
    }
    end = memchr(hdr->v1.line, '\r', len - 1);
    if (!end || end[1] != '\n') {
        return HDR_NEED_MORE;
    }
    *end = '\0';
    *hdr_len = end + 2 - hdr->v1.line;
    strcpy(buf, hdr->v1.line);
    apr_strtok(buf, " ", &saveptr);
    GET_NEXT_WORD("family")
    if (strcmp(word, "UNKNOWN") == 0) {
        conn_conf->client_addr = c->client_addr;
        conn_conf->client_ip = c->client_ip;
        return HDR_DONE;
    }
    else if (strcmp(word, "TCP4") == 0) {
        family = APR_INET;
        valid_addr_chars = "0123456789.";
    }
    else if (strcmp(word, "TCP6") == 0) {
#if APR_HAVE_IPV6
        family = APR_INET6;
        valid_addr_chars = "0123456789abcdefABCDEF:";
#else
        ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(03498)
                      "RemoteIPProxyProtocol: Unable to parse v6 address - APR is not compiled with IPv6 support",
                      word, hdr->v1.line);
        return HDR_ERROR;
#endif
    }
    else {
        ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(03499)
                      "RemoteIPProxyProtocol: unknown family '%s' in header '%s'",
                      word, hdr->v1.line);
        return HDR_ERROR;
    }
    GET_NEXT_WORD("client-address")
    if (strspn(word, valid_addr_chars) != strlen(word)) {
        ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(03500)
                      "RemoteIPProxyProtocol: invalid client-address '%s' found in "
                      "header '%s'", word, hdr->v1.line);
        return HDR_ERROR;
    }
    host = word;
    GET_NEXT_WORD("destination-address")
    GET_NEXT_WORD("client-port")
    if (sscanf(word, "%hu", &port) != 1) {
        ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(03501)
                      "RemoteIPProxyProtocol: error parsing port '%s' in header '%s'",
                      word, hdr->v1.line);
        return HDR_ERROR;
    }
    ret = apr_sockaddr_info_get(&conn_conf->client_addr, host, family, port, 0,
                                c->pool);
    if (ret != APR_SUCCESS) {
        conn_conf->client_addr = NULL;
        ap_log_cerror(APLOG_MARK, APLOG_ERR, ret, c, APLOGNO(03502)
                      "RemoteIPProxyProtocol: error converting family '%d', host '%s',"
                      " and port '%hu' to sockaddr; header was '%s'",
                      family, host, port, hdr->v1.line);
        return HDR_ERROR;
    }
    conn_conf->client_ip = apr_pstrdup(c->pool, host);
    return HDR_DONE;
}
['static apr_status_t remoteip_input_filter(ap_filter_t *f,\n                                    apr_bucket_brigade *bb_out,\n                                    ap_input_mode_t mode,\n                                    apr_read_type_e block,\n                                    apr_off_t readbytes)\n{\n    apr_status_t ret;\n    remoteip_filter_context *ctx = f->ctx;\n    remoteip_conn_config_t *conn_conf;\n    apr_bucket *b;\n    remoteip_parse_status_t psts;\n    const char *ptr;\n    apr_size_t len;\n    if (f->c->aborted) {\n        return APR_ECONNABORTED;\n    }\n    if (!ctx) {\n        ctx = f->ctx = apr_palloc(f->c->pool, sizeof(*ctx));\n        ctx->rcvd = 0;\n        ctx->need = MIN_HDR_LEN;\n        ctx->version = 0;\n        ctx->mode = AP_MODE_READBYTES;\n        ctx->bb = apr_brigade_create(f->c->pool, f->c->bucket_alloc);\n        ctx->done = 0;\n    }\n    if (ctx->done) {\n        return ap_get_brigade(f->next, bb_out, mode, block, readbytes);\n    }\n    conn_conf = ap_get_module_config(f->c->conn_config, &remoteip_module);\n    while (!ctx->done) {\n        if (APR_BRIGADE_EMPTY(ctx->bb)) {\n            ret = ap_get_brigade(f->next, ctx->bb, ctx->mode, block,\n                                 ctx->need - ctx->rcvd);\n            if (ret != APR_SUCCESS) {\n                return ret;\n            }\n        }\n        if (APR_BRIGADE_EMPTY(ctx->bb)) {\n            return APR_EOF;\n        }\n        while (!ctx->done && !APR_BRIGADE_EMPTY(ctx->bb)) {\n            b = APR_BRIGADE_FIRST(ctx->bb);\n            ret = apr_bucket_read(b, &ptr, &len, block);\n            if (APR_STATUS_IS_EAGAIN(ret) && block == APR_NONBLOCK_READ) {\n                return APR_SUCCESS;\n            }\n            if (ret != APR_SUCCESS) {\n                return ret;\n            }\n            memcpy(ctx->header + ctx->rcvd, ptr, len);\n            ctx->rcvd += len;\n            APR_BUCKET_REMOVE(b);\n            psts = HDR_NEED_MORE;\n            if (ctx->version == 0) {\n                if (ctx->rcvd >= MIN_HDR_LEN) {\n                    ctx->version = remoteip_determine_version(f->c, ctx->header);\n                    if (ctx->version < 0) {\n                        psts = HDR_MISSING;\n                    }\n                    else if (ctx->version == 1) {\n                        ctx->mode = AP_MODE_GETLINE;\n                        ctx->need = sizeof(proxy_v1);\n                    }\n                    else if (ctx->version == 2) {\n                        ctx->need = MIN_V2_HDR_LEN;\n                    }\n                }\n            }\n            else if (ctx->version == 1) {\n                psts = remoteip_process_v1_header(f->c, conn_conf,\n                                            (proxy_header *) ctx->header,\n                                            ctx->rcvd, &ctx->need);\n            }\n            else if (ctx->version == 2) {\n                if (ctx->rcvd >= MIN_V2_HDR_LEN) {\n                    ctx->need = MIN_V2_HDR_LEN +\n                                ntohs(((proxy_header *) ctx->header)->v2.len);\n                }\n                if (ctx->rcvd >= ctx->need) {\n                    psts = remoteip_process_v2_header(f->c, conn_conf,\n                                                (proxy_header *) ctx->header);\n                }\n            }\n            else {\n                ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, f->c, APLOGNO(03509)\n                              "RemoteIPProxyProtocol: internal error: unknown version "\n                              "%d", ctx->version);\n                f->c->aborted = 1;\n                apr_bucket_delete(b);\n                apr_brigade_destroy(ctx->bb);\n                return APR_ECONNABORTED;\n            }\n            switch (psts) {\n                case HDR_MISSING:\n                    if (conn_conf->proxy_protocol_optional) {\n                        ctx->done = 1;\n                        APR_BRIGADE_INSERT_HEAD(bb_out, b);\n                        return ap_pass_brigade(f->next, ctx->bb);\n                    }\n                    else {\n                        ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, f->c, APLOGNO(03510)\n                                     "RemoteIPProxyProtocol: no valid PROXY header found");\n                    }\n                case HDR_ERROR:\n                    f->c->aborted = 1;\n                    apr_bucket_delete(b);\n                    apr_brigade_destroy(ctx->bb);\n                    return APR_ECONNABORTED;\n                case HDR_DONE:\n                    apr_bucket_delete(b);\n                    ctx->done = 1;\n                    break;\n                case HDR_NEED_MORE:\n                    apr_bucket_delete(b);\n                    break;\n            }\n        }\n    }\n    if (psts == HDR_DONE) {\n        ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, f->c, APLOGNO(03511)\n                      "RemoteIPProxyProtocol: received valid PROXY header: %s:%hu",\n                      conn_conf->client_ip, conn_conf->client_addr->port);\n    }\n    else {\n        ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, f->c, APLOGNO(03512)\n                      "RemoteIPProxyProtocol: PROXY header was missing");\n    }\n    if (ctx->rcvd > ctx->need || !APR_BRIGADE_EMPTY(ctx->bb)) {\n        ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, f->c, APLOGNO(03513)\n                      "RemoteIPProxyProtocol: internal error: have data left over; "\n                      " need=%lu, rcvd=%lu, brigade-empty=%d", ctx->need,\n                      ctx->rcvd, APR_BRIGADE_EMPTY(ctx->bb));\n        f->c->aborted = 1;\n        apr_brigade_destroy(ctx->bb);\n        return APR_ECONNABORTED;\n    }\n    apr_brigade_destroy(ctx->bb);\n    ctx->bb = NULL;\n    return ap_get_brigade(f->next, bb_out, mode, block, readbytes);\n}', 'static remoteip_parse_status_t remoteip_process_v1_header(conn_rec *c,\n                                                          remoteip_conn_config_t *conn_conf,\n                                                          proxy_header *hdr, apr_size_t len,\n                                                          apr_size_t *hdr_len)\n{\n    char *end, *word, *host, *valid_addr_chars, *saveptr;\n    char buf[sizeof(hdr->v1.line)];\n    apr_port_t port;\n    apr_status_t ret;\n    apr_int32_t family;\n#define GET_NEXT_WORD(field) \\\n    word = apr_strtok(NULL, " ", &saveptr); \\\n    if (!word) { \\\n        ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(03497) \\\n                      "RemoteIPProxyProtocol: no " field " found in header \'%s\'", \\\n                      hdr->v1.line); \\\n        return HDR_ERROR; \\\n    }\n    end = memchr(hdr->v1.line, \'\\r\', len - 1);\n    if (!end || end[1] != \'\\n\') {\n        return HDR_NEED_MORE;\n    }\n    *end = \'\\0\';\n    *hdr_len = end + 2 - hdr->v1.line;\n    strcpy(buf, hdr->v1.line);\n    apr_strtok(buf, " ", &saveptr);\n    GET_NEXT_WORD("family")\n    if (strcmp(word, "UNKNOWN") == 0) {\n        conn_conf->client_addr = c->client_addr;\n        conn_conf->client_ip = c->client_ip;\n        return HDR_DONE;\n    }\n    else if (strcmp(word, "TCP4") == 0) {\n        family = APR_INET;\n        valid_addr_chars = "0123456789.";\n    }\n    else if (strcmp(word, "TCP6") == 0) {\n#if APR_HAVE_IPV6\n        family = APR_INET6;\n        valid_addr_chars = "0123456789abcdefABCDEF:";\n#else\n        ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(03498)\n                      "RemoteIPProxyProtocol: Unable to parse v6 address - APR is not compiled with IPv6 support",\n                      word, hdr->v1.line);\n        return HDR_ERROR;\n#endif\n    }\n    else {\n        ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(03499)\n                      "RemoteIPProxyProtocol: unknown family \'%s\' in header \'%s\'",\n                      word, hdr->v1.line);\n        return HDR_ERROR;\n    }\n    GET_NEXT_WORD("client-address")\n    if (strspn(word, valid_addr_chars) != strlen(word)) {\n        ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(03500)\n                      "RemoteIPProxyProtocol: invalid client-address \'%s\' found in "\n                      "header \'%s\'", word, hdr->v1.line);\n        return HDR_ERROR;\n    }\n    host = word;\n    GET_NEXT_WORD("destination-address")\n    GET_NEXT_WORD("client-port")\n    if (sscanf(word, "%hu", &port) != 1) {\n        ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(03501)\n                      "RemoteIPProxyProtocol: error parsing port \'%s\' in header \'%s\'",\n                      word, hdr->v1.line);\n        return HDR_ERROR;\n    }\n    ret = apr_sockaddr_info_get(&conn_conf->client_addr, host, family, port, 0,\n                                c->pool);\n    if (ret != APR_SUCCESS) {\n        conn_conf->client_addr = NULL;\n        ap_log_cerror(APLOG_MARK, APLOG_ERR, ret, c, APLOGNO(03502)\n                      "RemoteIPProxyProtocol: error converting family \'%d\', host \'%s\',"\n                      " and port \'%hu\' to sockaddr; header was \'%s\'",\n                      family, host, port, hdr->v1.line);\n        return HDR_ERROR;\n    }\n    conn_conf->client_ip = apr_pstrdup(c->pool, host);\n    return HDR_DONE;\n}']