Report information
The Basics
Id:
46244
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
Cc:
AdminCc:

BugTracker
Version Fixed:
9.12.0
Version Found:
(no value)
Versions Affected:
(no value)
Versions Planned:
(no value)
Priority:
P3 Low
Severity:
S3 Low
CVSS Score:
(no value)
CVE ID:
(no value)
Component:
(no value)
Area:
test

Dates
Created:Tue, 10 Oct 2017 18:31:50 -0400
Updated:Wed, 11 Oct 2017 03:32:26 -0400
Closed:Wed, 11 Oct 2017 03:32:26 -0400



This bug tracker is no longer active.

Please go to our Gitlab to submit issues (both feature requests and bug reports) for active projects maintained by Internet Systems Consortium (ISC).

Due to security and confidentiality requirements, full access is limited to the primary maintainers.

To: bind9-public@isc.org
From: ckb@isc.org
Subject: isc_buffer_printf unit test failure
Date: Tue, 10 Oct 2017 15:31:50 -0700
Failed test cases: lib/isc/tests/buffer_test:isc_buffer_printf isc_buffer_printf: [0.004462s] Failed: 1 checks failed; see output for more details output: tc-se:*** Check failed: buffer_test.c:279: result != ISC_R_FAILURE Fails on freebsd and OSX
On Tue Oct 10 12:31:51 2017, ckb wrote: > Failed test cases: > lib/isc/tests/buffer_test:isc_buffer_printf > > isc_buffer_printf: [0.004462s] Failed: 1 checks failed; see output for > more details > > output: > tc-se:*** Check failed: buffer_test.c:279: result != ISC_R_FAILURE > > Fails on freebsd and OSX A "%" format specifier hits this part of the specification. "If a conversion specification does not match one of the above forms, the behavior is undefined. If any argument is not the correct type for the corresponding conversion specification, the behavior is undefined." http://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html As you can see on Darwin you get n=0 and nothing written to the buffer. [rock:~/git/bind9] marka% cat oo.c #include <stdio.h> #include <string.h> int main(int argc, char **argv) { char buf[15]; int n; memset(buf, 0, sizeof(buf)); n = snprintf(buf, sizeof(buf), "%"); printf("%02x %02x %d\n", buf[0], buf[1], n); } [rock:~/git/bind9] marka% cc oo.c -Wno-format [rock:~/git/bind9] marka% ./a.out 00 00 0 [rock:~/git/bind9] marka% I recommend that we remove this test case as it depends on unspecified behaviour.
The empty format test was unnecessarily complicated. The test has been updated.
CC:
To: "Mark Andrews via RT" <bind9-public@isc.org>
Date: Wed, 11 Oct 2017 00:55:38 +0000
Subject: Re: [ISC-Bugs #46244] isc_buffer_printf unit test failure
From: "Evan Hunt" <each@isc.org>
> The empty format test was unnecessarily complicated. > The test has been updated. The third argument is actually required by some compilers; without it you get a warning that causes compilation failure with --enable-developer. (Yes, it's stupid.)
Reverted Mark's simplification of the empty format unit test as per Evan's comment (BTW, gcc elicits a warning if you just use an empty string literal as the second argument to isc_buffer_printf(), hence the "overcomplication"). Dropped bad format test due to lack of options to consistently get a negative return value out of vsnprintf() on all supported operating systems. Ready for review.
Thanks, Ondrej. Merged without CHANGES note.