Hi Xavier! On 5/11/20 11:56 PM, Xavier wrote: > Could someone help us here ? I forwarded this bug to upstream ([1]) but > didn't receive any response for now. > > (Cc to RFH bug)
The problem here is va_list. On some architectures, the calling convention doesn't seem to allow comparing va_list against NULL due to the way va_list is implemented on a particular architecture. You could maybe add an auxiliary boolean variable to control whether "va_list args" is empty or not, i.e. something like this: Index: cyrus-imapd-3.2.0/imap/httpd.c =================================================================== --- cyrus-imapd-3.2.0.orig/imap/httpd.c +++ cyrus-imapd-3.2.0/imap/httpd.c @@ -2350,7 +2350,7 @@ EXPORTED void simple_hdr(struct transact simple_hdr(txn, "Access-Control-Expose-Headers", hdr) static void comma_list_body(struct buf *buf, - const char *vals[], unsigned flags, va_list args) + const char *vals[], unsigned flags, int has_args, va_list args) { const char *sep = ""; int i; @@ -2358,11 +2358,11 @@ static void comma_list_body(struct buf * for (i = 0; vals[i]; i++) { if (flags & (1 << i)) { buf_appendcstr(buf, sep); - if (args) buf_vprintf(buf, vals[i], args); + if (has_args) buf_vprintf(buf, vals[i], args); else buf_appendcstr(buf, vals[i]); sep = ", "; } - else if (args) { + else if (has_args) { /* discard any unused args */ vsnprintf(NULL, 0, vals[i], args); } @@ -2377,7 +2377,7 @@ EXPORTED void comma_list_hdr(struct tran va_start(args, flags); - comma_list_body(&buf, vals, flags, args); + comma_list_body(&buf, vals, flags, 1, args); va_end(args); @@ -3077,17 +3077,17 @@ EXPORTED void response_header(long code, } if (code == HTTP_SWITCH_PROT || code == HTTP_UPGRADE) { buf_printf(logbuf, "%supgrade=", sep); - comma_list_body(logbuf, upgrd_tokens, txn->flags.upgrade, NULL); + comma_list_body(logbuf, upgrd_tokens, txn->flags.upgrade, 0, 0); sep = "; "; } if (txn->flags.te) { buf_printf(logbuf, "%stx-encoding=", sep); - comma_list_body(logbuf, te, txn->flags.te, NULL); + comma_list_body(logbuf, te, txn->flags.te, 0, 0); sep = "; "; } if (txn->resp_body.enc.proc) { buf_printf(logbuf, "%scnt-encoding=", sep); - comma_list_body(logbuf, ce, txn->resp_body.enc.type, NULL); + comma_list_body(logbuf, ce, txn->resp_body.enc.type, 0, 0); sep = "; "; } if (txn->location) { Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaub...@debian.org `. `' Freie Universitaet Berlin - glaub...@physik.fu-berlin.de `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Description: Don't try to compare va_list against NULL Author: John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de> Last-Update: 2020-05-12 Index: cyrus-imapd-3.2.0/imap/httpd.c =================================================================== --- cyrus-imapd-3.2.0.orig/imap/httpd.c +++ cyrus-imapd-3.2.0/imap/httpd.c @@ -2350,7 +2350,7 @@ EXPORTED void simple_hdr(struct transact simple_hdr(txn, "Access-Control-Expose-Headers", hdr) static void comma_list_body(struct buf *buf, - const char *vals[], unsigned flags, va_list args) + const char *vals[], unsigned flags, int has_args, va_list args) { const char *sep = ""; int i; @@ -2358,11 +2358,11 @@ static void comma_list_body(struct buf * for (i = 0; vals[i]; i++) { if (flags & (1 << i)) { buf_appendcstr(buf, sep); - if (args) buf_vprintf(buf, vals[i], args); + if (has_args) buf_vprintf(buf, vals[i], args); else buf_appendcstr(buf, vals[i]); sep = ", "; } - else if (args) { + else if (has_args) { /* discard any unused args */ vsnprintf(NULL, 0, vals[i], args); } @@ -2377,7 +2377,7 @@ EXPORTED void comma_list_hdr(struct tran va_start(args, flags); - comma_list_body(&buf, vals, flags, args); + comma_list_body(&buf, vals, flags, 1, args); va_end(args); @@ -3077,17 +3077,17 @@ EXPORTED void response_header(long code, } if (code == HTTP_SWITCH_PROT || code == HTTP_UPGRADE) { buf_printf(logbuf, "%supgrade=", sep); - comma_list_body(logbuf, upgrd_tokens, txn->flags.upgrade, NULL); + comma_list_body(logbuf, upgrd_tokens, txn->flags.upgrade, 0, 0); sep = "; "; } if (txn->flags.te) { buf_printf(logbuf, "%stx-encoding=", sep); - comma_list_body(logbuf, te, txn->flags.te, NULL); + comma_list_body(logbuf, te, txn->flags.te, 0, 0); sep = "; "; } if (txn->resp_body.enc.proc) { buf_printf(logbuf, "%scnt-encoding=", sep); - comma_list_body(logbuf, ce, txn->resp_body.enc.type, NULL); + comma_list_body(logbuf, ce, txn->resp_body.enc.type, 0, 0); sep = "; "; } if (txn->location) {