#
1.36 |
|
08-Apr-2024 |
rillig |
snprintb.3: provide examples for hexadecimal character escapes
Suggested by uwe@, in reaction to the previous commit, which preferred octal in the examples. Hexadecimal escapes are more familiar to most programmers, and the chance of mistaking \x14 for decimal 14 is less than the chance of mistaking octal \014 for decimal 14.
|
#
1.35 |
|
07-Apr-2024 |
rillig |
snprintb: reject empty bit descriptions and wrongly placed defaults
|
#
1.34 |
|
07-Apr-2024 |
rillig |
snprintb: reject combinations of 'f' with ':' as well as 'F' with '='
These combinations would lead to garbled output.
|
#
1.33 |
|
07-Apr-2024 |
rillig |
snprintb: reject empty descriptions
In cases where the snprintb output is garbled, it is not trustworthy, so make sure the mistakes in the bitfmt are fixed early.
|
#
1.32 |
|
01-Apr-2024 |
rillig |
tests/snprintb_m: test null-terminated output in error case
While here, clean up the buffer handling for the visualized array content in case of a failed test.
|
#
1.31 |
|
25-Mar-2024 |
rillig |
snprintb: mark the end of the buffer if the buffer is too small
This avoids confusion in case the buffer ends with an incomplete number.
|
#
1.30 |
|
04-Mar-2024 |
rillig |
snprintb: error out on unknown new-style formatting directive
|
#
1.29 |
|
24-Feb-2024 |
rillig |
tests/snprintb: clean up tests
Always write the value to be formatted in hexadecimal, to make it easily distinguishable from the buffer size and maximum line length.
Use consistent wording in the comments of the test cases. Be stricter about mistakes in a format.
Fix some wrong numbers in the snprintb_m tests for limited line length.
|
#
1.28 |
|
24-Feb-2024 |
rillig |
snprintb: allow non-ASCII descriptions on all platforms
Previously, these descriptions were only allowed on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, they invoked undefined behavior or terminated the output early.
|
#
1.27 |
|
22-Feb-2024 |
rillig |
snprintb: always null-terminate output
Always null-terminate the output in the buffer, even in error cases. The wording in the manual page has been promising this since 2008. For snprintb_m, ensure that the output is terminated with two null characters, to gracefully handle situations in which the caller does not check whether snprintb returned an error.
If the buffer size is zero, allow the buffer to be a null pointer, analogous to snprintf.
Fix an out-of-bounds memory read if the bitfmt ends with a '*' directive (since today).
In the tests, merge the helper functions for snprintb, snprintb_m, as they were similar enough.
Fix a few 'line_max exceeded' tests, ensuring that they output a '#' marker, and that the 'complete' tests don't.
|
#
1.26 |
|
22-Feb-2024 |
rillig |
snprintb: error out on out-of-bounds bit shifts
Previously, these invoked undefined behavior, now they lead to an early return. An example of out-of-bounds bit number is in SCZ_PCICTRL_BITS. Bit fields that extend beyond the msb are still allowed.
Allow 'f' and 'F' to have fields that are 64 bits wide. This only makes sense when the field starts at bit 0.
Remove the unused 'val_len', it was only needed before snprintb.c 1.20.
|
#
1.25 |
|
20-Feb-2024 |
rillig |
tests/snprintb: test '=' and '*' directives that can never match
|
#
1.24 |
|
20-Feb-2024 |
rillig |
snprintb_m: limit length of generated strings
The manual page promises that the 'max' argument limits the length of the generated strings, so don't generate any strings that are longer than that limit. Mark incomplete strings with a trailing '#' to make them easily recognizable.
|
#
1.23 |
|
20-Feb-2024 |
rillig |
tests/snprintb: fix out-of-bounds memory read (since 2024-02-16)
Before t_snprintb.c 1.20, the buffer size was required to be greater than zero. Allowing the buffer size to be zero led to buf[-1] being checked. On amd64, that byte happened to be 0, on i386 it didn't.
Fixes PR lib/57951.
|
#
1.22 |
|
19-Feb-2024 |
rillig |
snprintb: fix how named bit-fields are split into multiple lines
|
#
1.21 |
|
19-Feb-2024 |
rillig |
tests/snprintb: add more tests, especially for snprintb_m
|
#
1.20 |
|
16-Feb-2024 |
rillig |
snprintb: eliminate two local variables, allow zero-size buffer
Like snprintf, the buffer size may be zero. Unlike snprintf, the buffer must not be NULL.
|
#
1.19 |
|
16-Feb-2024 |
rillig |
snprintb: fix integer overflow when writing past a small buffer
Previously, snprintb returned -1 in this case, assuming that the snprintf used in FMTSTR validates against an overly large buffer size.
|
#
1.18 |
|
16-Feb-2024 |
rillig |
tests/snprintb: fix test for 8-bit field value
The previous version tested the behavior on a platform with signed 'char' before the portability fix.
|
#
1.17 |
|
16-Feb-2024 |
rillig |
snprintb: fix '=' and ':' for 8-bit values on platforms with signed char
Previously, '=' and ':' worked only on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, only 7-bit values worked.
|
#
1.16 |
|
16-Feb-2024 |
rillig |
tests/snprintb: clean up existing tests, add more tests
Due to the check that any bytes beyond the expected output must be unmodified, there's no need anymore to explicitly write the "ZZZ" at the end of the expected output. While here, remove the redundant trailing "\0".
Add more tests to cover possible situations where an out-of-bounds write may have occurred. In some cases, the line length specified in snprintb_m is exceeded.
|
#
1.15 |
|
15-Feb-2024 |
rillig |
snprintb: fix string termination (since today)
In the previous commit, I had accidentally only run the tests for snprintb_m but not those for snprintb, thereby missing a newly introduced bug that would not null-terminate the resulting strings.
Add more tests to cover similar situations in which the buffer is too small to contain the complete output.
|
#
1.14 |
|
15-Feb-2024 |
rillig |
snprintb: fix out-of-bounds write
|
#
1.13 |
|
14-Feb-2024 |
rillig |
tests/libutil/snprintb_m: add tests for small line length
|
#
1.12 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: remove redundant integer constant suffixes
I added these because lint told me so. Lint was wrong though, as it had not implemented the C99 rules for integer constants.
|
#
1.11 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: fix test for 32-bit platforms
|
#
1.10 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: add more tests
Test all number bases (octal, decimal, hexadecimal), in both old-style and new-style formats, as well as small buffer sizes.
Document working edge cases such as empty descriptions or descriptions containing spaces, as well as situations that invoke undefined behavior.
Add comments to the individual test cases, as reading the actual format strings takes more time.
|
#
1.9 |
|
25-Jan-2024 |
rillig |
tests/libutil/snprintb: clean up and extend tests
In case of a failure, print the details of the test case, including file and line number of the actual test data. Do not write the format strings directly to the output, as they contain non-printable bytes and embedded null bytes.
After a failed test case, continue with the others.
Lay out the format strings according to their structure, to make them more readable. Remove redundant "\0" at the end of the new-style format strings.
Fix an off-by-one error in the test data: 0xf is FIFTEEN, not SIXTEEN.
Add a test for performing a restricted subset of rot13 in the format string, to explore the limits of snprintb formatting.
What's still missing are tests for edge cases and error cases.
|
Revision tags: netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
|
#
1.8 |
|
08-Dec-2019 |
christos |
Adjust tests for 0 hex values printing 0 instead of 0x0
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.36 |
|
08-Apr-2024 |
rillig |
snprintb.3: provide examples for hexadecimal character escapes
Suggested by uwe@, in reaction to the previous commit, which preferred octal in the examples. Hexadecimal escapes are more familiar to most programmers, and the chance of mistaking \x14 for decimal 14 is less than the chance of mistaking octal \014 for decimal 14.
|
#
1.35 |
|
07-Apr-2024 |
rillig |
snprintb: reject empty bit descriptions and wrongly placed defaults
|
#
1.34 |
|
07-Apr-2024 |
rillig |
snprintb: reject combinations of 'f' with ':' as well as 'F' with '='
These combinations would lead to garbled output.
|
#
1.33 |
|
07-Apr-2024 |
rillig |
snprintb: reject empty descriptions
In cases where the snprintb output is garbled, it is not trustworthy, so make sure the mistakes in the bitfmt are fixed early.
|
#
1.32 |
|
01-Apr-2024 |
rillig |
tests/snprintb_m: test null-terminated output in error case
While here, clean up the buffer handling for the visualized array content in case of a failed test.
|
#
1.31 |
|
25-Mar-2024 |
rillig |
snprintb: mark the end of the buffer if the buffer is too small
This avoids confusion in case the buffer ends with an incomplete number.
|
#
1.30 |
|
04-Mar-2024 |
rillig |
snprintb: error out on unknown new-style formatting directive
|
#
1.29 |
|
24-Feb-2024 |
rillig |
tests/snprintb: clean up tests
Always write the value to be formatted in hexadecimal, to make it easily distinguishable from the buffer size and maximum line length.
Use consistent wording in the comments of the test cases. Be stricter about mistakes in a format.
Fix some wrong numbers in the snprintb_m tests for limited line length.
|
#
1.28 |
|
24-Feb-2024 |
rillig |
snprintb: allow non-ASCII descriptions on all platforms
Previously, these descriptions were only allowed on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, they invoked undefined behavior or terminated the output early.
|
#
1.27 |
|
22-Feb-2024 |
rillig |
snprintb: always null-terminate output
Always null-terminate the output in the buffer, even in error cases. The wording in the manual page has been promising this since 2008. For snprintb_m, ensure that the output is terminated with two null characters, to gracefully handle situations in which the caller does not check whether snprintb returned an error.
If the buffer size is zero, allow the buffer to be a null pointer, analogous to snprintf.
Fix an out-of-bounds memory read if the bitfmt ends with a '*' directive (since today).
In the tests, merge the helper functions for snprintb, snprintb_m, as they were similar enough.
Fix a few 'line_max exceeded' tests, ensuring that they output a '#' marker, and that the 'complete' tests don't.
|
#
1.26 |
|
22-Feb-2024 |
rillig |
snprintb: error out on out-of-bounds bit shifts
Previously, these invoked undefined behavior, now they lead to an early return. An example of out-of-bounds bit number is in SCZ_PCICTRL_BITS. Bit fields that extend beyond the msb are still allowed.
Allow 'f' and 'F' to have fields that are 64 bits wide. This only makes sense when the field starts at bit 0.
Remove the unused 'val_len', it was only needed before snprintb.c 1.20.
|
#
1.25 |
|
20-Feb-2024 |
rillig |
tests/snprintb: test '=' and '*' directives that can never match
|
#
1.24 |
|
20-Feb-2024 |
rillig |
snprintb_m: limit length of generated strings
The manual page promises that the 'max' argument limits the length of the generated strings, so don't generate any strings that are longer than that limit. Mark incomplete strings with a trailing '#' to make them easily recognizable.
|
#
1.23 |
|
20-Feb-2024 |
rillig |
tests/snprintb: fix out-of-bounds memory read (since 2024-02-16)
Before t_snprintb.c 1.20, the buffer size was required to be greater than zero. Allowing the buffer size to be zero led to buf[-1] being checked. On amd64, that byte happened to be 0, on i386 it didn't.
Fixes PR lib/57951.
|
#
1.22 |
|
19-Feb-2024 |
rillig |
snprintb: fix how named bit-fields are split into multiple lines
|
#
1.21 |
|
19-Feb-2024 |
rillig |
tests/snprintb: add more tests, especially for snprintb_m
|
#
1.20 |
|
16-Feb-2024 |
rillig |
snprintb: eliminate two local variables, allow zero-size buffer
Like snprintf, the buffer size may be zero. Unlike snprintf, the buffer must not be NULL.
|
#
1.19 |
|
16-Feb-2024 |
rillig |
snprintb: fix integer overflow when writing past a small buffer
Previously, snprintb returned -1 in this case, assuming that the snprintf used in FMTSTR validates against an overly large buffer size.
|
#
1.18 |
|
16-Feb-2024 |
rillig |
tests/snprintb: fix test for 8-bit field value
The previous version tested the behavior on a platform with signed 'char' before the portability fix.
|
#
1.17 |
|
16-Feb-2024 |
rillig |
snprintb: fix '=' and ':' for 8-bit values on platforms with signed char
Previously, '=' and ':' worked only on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, only 7-bit values worked.
|
#
1.16 |
|
16-Feb-2024 |
rillig |
tests/snprintb: clean up existing tests, add more tests
Due to the check that any bytes beyond the expected output must be unmodified, there's no need anymore to explicitly write the "ZZZ" at the end of the expected output. While here, remove the redundant trailing "\0".
Add more tests to cover possible situations where an out-of-bounds write may have occurred. In some cases, the line length specified in snprintb_m is exceeded.
|
#
1.15 |
|
15-Feb-2024 |
rillig |
snprintb: fix string termination (since today)
In the previous commit, I had accidentally only run the tests for snprintb_m but not those for snprintb, thereby missing a newly introduced bug that would not null-terminate the resulting strings.
Add more tests to cover similar situations in which the buffer is too small to contain the complete output.
|
#
1.14 |
|
15-Feb-2024 |
rillig |
snprintb: fix out-of-bounds write
|
#
1.13 |
|
14-Feb-2024 |
rillig |
tests/libutil/snprintb_m: add tests for small line length
|
#
1.12 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: remove redundant integer constant suffixes
I added these because lint told me so. Lint was wrong though, as it had not implemented the C99 rules for integer constants.
|
#
1.11 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: fix test for 32-bit platforms
|
#
1.10 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: add more tests
Test all number bases (octal, decimal, hexadecimal), in both old-style and new-style formats, as well as small buffer sizes.
Document working edge cases such as empty descriptions or descriptions containing spaces, as well as situations that invoke undefined behavior.
Add comments to the individual test cases, as reading the actual format strings takes more time.
|
#
1.9 |
|
25-Jan-2024 |
rillig |
tests/libutil/snprintb: clean up and extend tests
In case of a failure, print the details of the test case, including file and line number of the actual test data. Do not write the format strings directly to the output, as they contain non-printable bytes and embedded null bytes.
After a failed test case, continue with the others.
Lay out the format strings according to their structure, to make them more readable. Remove redundant "\0" at the end of the new-style format strings.
Fix an off-by-one error in the test data: 0xf is FIFTEEN, not SIXTEEN.
Add a test for performing a restricted subset of rot13 in the format string, to explore the limits of snprintb formatting.
What's still missing are tests for edge cases and error cases.
|
Revision tags: netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
|
#
1.8 |
|
08-Dec-2019 |
christos |
Adjust tests for 0 hex values printing 0 instead of 0x0
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.32 |
|
01-Apr-2024 |
rillig |
tests/snprintb_m: test null-terminated output in error case
While here, clean up the buffer handling for the visualized array content in case of a failed test.
|
#
1.31 |
|
25-Mar-2024 |
rillig |
snprintb: mark the end of the buffer if the buffer is too small
This avoids confusion in case the buffer ends with an incomplete number.
|
#
1.30 |
|
04-Mar-2024 |
rillig |
snprintb: error out on unknown new-style formatting directive
|
#
1.29 |
|
24-Feb-2024 |
rillig |
tests/snprintb: clean up tests
Always write the value to be formatted in hexadecimal, to make it easily distinguishable from the buffer size and maximum line length.
Use consistent wording in the comments of the test cases. Be stricter about mistakes in a format.
Fix some wrong numbers in the snprintb_m tests for limited line length.
|
#
1.28 |
|
24-Feb-2024 |
rillig |
snprintb: allow non-ASCII descriptions on all platforms
Previously, these descriptions were only allowed on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, they invoked undefined behavior or terminated the output early.
|
#
1.27 |
|
22-Feb-2024 |
rillig |
snprintb: always null-terminate output
Always null-terminate the output in the buffer, even in error cases. The wording in the manual page has been promising this since 2008. For snprintb_m, ensure that the output is terminated with two null characters, to gracefully handle situations in which the caller does not check whether snprintb returned an error.
If the buffer size is zero, allow the buffer to be a null pointer, analogous to snprintf.
Fix an out-of-bounds memory read if the bitfmt ends with a '*' directive (since today).
In the tests, merge the helper functions for snprintb, snprintb_m, as they were similar enough.
Fix a few 'line_max exceeded' tests, ensuring that they output a '#' marker, and that the 'complete' tests don't.
|
#
1.26 |
|
22-Feb-2024 |
rillig |
snprintb: error out on out-of-bounds bit shifts
Previously, these invoked undefined behavior, now they lead to an early return. An example of out-of-bounds bit number is in SCZ_PCICTRL_BITS. Bit fields that extend beyond the msb are still allowed.
Allow 'f' and 'F' to have fields that are 64 bits wide. This only makes sense when the field starts at bit 0.
Remove the unused 'val_len', it was only needed before snprintb.c 1.20.
|
#
1.25 |
|
20-Feb-2024 |
rillig |
tests/snprintb: test '=' and '*' directives that can never match
|
#
1.24 |
|
20-Feb-2024 |
rillig |
snprintb_m: limit length of generated strings
The manual page promises that the 'max' argument limits the length of the generated strings, so don't generate any strings that are longer than that limit. Mark incomplete strings with a trailing '#' to make them easily recognizable.
|
#
1.23 |
|
20-Feb-2024 |
rillig |
tests/snprintb: fix out-of-bounds memory read (since 2024-02-16)
Before t_snprintb.c 1.20, the buffer size was required to be greater than zero. Allowing the buffer size to be zero led to buf[-1] being checked. On amd64, that byte happened to be 0, on i386 it didn't.
Fixes PR lib/57951.
|
#
1.22 |
|
19-Feb-2024 |
rillig |
snprintb: fix how named bit-fields are split into multiple lines
|
#
1.21 |
|
19-Feb-2024 |
rillig |
tests/snprintb: add more tests, especially for snprintb_m
|
#
1.20 |
|
16-Feb-2024 |
rillig |
snprintb: eliminate two local variables, allow zero-size buffer
Like snprintf, the buffer size may be zero. Unlike snprintf, the buffer must not be NULL.
|
#
1.19 |
|
16-Feb-2024 |
rillig |
snprintb: fix integer overflow when writing past a small buffer
Previously, snprintb returned -1 in this case, assuming that the snprintf used in FMTSTR validates against an overly large buffer size.
|
#
1.18 |
|
16-Feb-2024 |
rillig |
tests/snprintb: fix test for 8-bit field value
The previous version tested the behavior on a platform with signed 'char' before the portability fix.
|
#
1.17 |
|
16-Feb-2024 |
rillig |
snprintb: fix '=' and ':' for 8-bit values on platforms with signed char
Previously, '=' and ':' worked only on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, only 7-bit values worked.
|
#
1.16 |
|
16-Feb-2024 |
rillig |
tests/snprintb: clean up existing tests, add more tests
Due to the check that any bytes beyond the expected output must be unmodified, there's no need anymore to explicitly write the "ZZZ" at the end of the expected output. While here, remove the redundant trailing "\0".
Add more tests to cover possible situations where an out-of-bounds write may have occurred. In some cases, the line length specified in snprintb_m is exceeded.
|
#
1.15 |
|
15-Feb-2024 |
rillig |
snprintb: fix string termination (since today)
In the previous commit, I had accidentally only run the tests for snprintb_m but not those for snprintb, thereby missing a newly introduced bug that would not null-terminate the resulting strings.
Add more tests to cover similar situations in which the buffer is too small to contain the complete output.
|
#
1.14 |
|
15-Feb-2024 |
rillig |
snprintb: fix out-of-bounds write
|
#
1.13 |
|
14-Feb-2024 |
rillig |
tests/libutil/snprintb_m: add tests for small line length
|
#
1.12 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: remove redundant integer constant suffixes
I added these because lint told me so. Lint was wrong though, as it had not implemented the C99 rules for integer constants.
|
#
1.11 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: fix test for 32-bit platforms
|
#
1.10 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: add more tests
Test all number bases (octal, decimal, hexadecimal), in both old-style and new-style formats, as well as small buffer sizes.
Document working edge cases such as empty descriptions or descriptions containing spaces, as well as situations that invoke undefined behavior.
Add comments to the individual test cases, as reading the actual format strings takes more time.
|
#
1.9 |
|
25-Jan-2024 |
rillig |
tests/libutil/snprintb: clean up and extend tests
In case of a failure, print the details of the test case, including file and line number of the actual test data. Do not write the format strings directly to the output, as they contain non-printable bytes and embedded null bytes.
After a failed test case, continue with the others.
Lay out the format strings according to their structure, to make them more readable. Remove redundant "\0" at the end of the new-style format strings.
Fix an off-by-one error in the test data: 0xf is FIFTEEN, not SIXTEEN.
Add a test for performing a restricted subset of rot13 in the format string, to explore the limits of snprintb formatting.
What's still missing are tests for edge cases and error cases.
|
Revision tags: netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
|
#
1.8 |
|
08-Dec-2019 |
christos |
Adjust tests for 0 hex values printing 0 instead of 0x0
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.31 |
|
25-Mar-2024 |
rillig |
snprintb: mark the end of the buffer if the buffer is too small
This avoids confusion in case the buffer ends with an incomplete number.
|
#
1.30 |
|
04-Mar-2024 |
rillig |
snprintb: error out on unknown new-style formatting directive
|
#
1.29 |
|
24-Feb-2024 |
rillig |
tests/snprintb: clean up tests
Always write the value to be formatted in hexadecimal, to make it easily distinguishable from the buffer size and maximum line length.
Use consistent wording in the comments of the test cases. Be stricter about mistakes in a format.
Fix some wrong numbers in the snprintb_m tests for limited line length.
|
#
1.28 |
|
24-Feb-2024 |
rillig |
snprintb: allow non-ASCII descriptions on all platforms
Previously, these descriptions were only allowed on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, they invoked undefined behavior or terminated the output early.
|
#
1.27 |
|
22-Feb-2024 |
rillig |
snprintb: always null-terminate output
Always null-terminate the output in the buffer, even in error cases. The wording in the manual page has been promising this since 2008. For snprintb_m, ensure that the output is terminated with two null characters, to gracefully handle situations in which the caller does not check whether snprintb returned an error.
If the buffer size is zero, allow the buffer to be a null pointer, analogous to snprintf.
Fix an out-of-bounds memory read if the bitfmt ends with a '*' directive (since today).
In the tests, merge the helper functions for snprintb, snprintb_m, as they were similar enough.
Fix a few 'line_max exceeded' tests, ensuring that they output a '#' marker, and that the 'complete' tests don't.
|
#
1.26 |
|
22-Feb-2024 |
rillig |
snprintb: error out on out-of-bounds bit shifts
Previously, these invoked undefined behavior, now they lead to an early return. An example of out-of-bounds bit number is in SCZ_PCICTRL_BITS. Bit fields that extend beyond the msb are still allowed.
Allow 'f' and 'F' to have fields that are 64 bits wide. This only makes sense when the field starts at bit 0.
Remove the unused 'val_len', it was only needed before snprintb.c 1.20.
|
#
1.25 |
|
20-Feb-2024 |
rillig |
tests/snprintb: test '=' and '*' directives that can never match
|
#
1.24 |
|
20-Feb-2024 |
rillig |
snprintb_m: limit length of generated strings
The manual page promises that the 'max' argument limits the length of the generated strings, so don't generate any strings that are longer than that limit. Mark incomplete strings with a trailing '#' to make them easily recognizable.
|
#
1.23 |
|
20-Feb-2024 |
rillig |
tests/snprintb: fix out-of-bounds memory read (since 2024-02-16)
Before t_snprintb.c 1.20, the buffer size was required to be greater than zero. Allowing the buffer size to be zero led to buf[-1] being checked. On amd64, that byte happened to be 0, on i386 it didn't.
Fixes PR lib/57951.
|
#
1.22 |
|
19-Feb-2024 |
rillig |
snprintb: fix how named bit-fields are split into multiple lines
|
#
1.21 |
|
19-Feb-2024 |
rillig |
tests/snprintb: add more tests, especially for snprintb_m
|
#
1.20 |
|
16-Feb-2024 |
rillig |
snprintb: eliminate two local variables, allow zero-size buffer
Like snprintf, the buffer size may be zero. Unlike snprintf, the buffer must not be NULL.
|
#
1.19 |
|
16-Feb-2024 |
rillig |
snprintb: fix integer overflow when writing past a small buffer
Previously, snprintb returned -1 in this case, assuming that the snprintf used in FMTSTR validates against an overly large buffer size.
|
#
1.18 |
|
16-Feb-2024 |
rillig |
tests/snprintb: fix test for 8-bit field value
The previous version tested the behavior on a platform with signed 'char' before the portability fix.
|
#
1.17 |
|
16-Feb-2024 |
rillig |
snprintb: fix '=' and ':' for 8-bit values on platforms with signed char
Previously, '=' and ':' worked only on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, only 7-bit values worked.
|
#
1.16 |
|
16-Feb-2024 |
rillig |
tests/snprintb: clean up existing tests, add more tests
Due to the check that any bytes beyond the expected output must be unmodified, there's no need anymore to explicitly write the "ZZZ" at the end of the expected output. While here, remove the redundant trailing "\0".
Add more tests to cover possible situations where an out-of-bounds write may have occurred. In some cases, the line length specified in snprintb_m is exceeded.
|
#
1.15 |
|
15-Feb-2024 |
rillig |
snprintb: fix string termination (since today)
In the previous commit, I had accidentally only run the tests for snprintb_m but not those for snprintb, thereby missing a newly introduced bug that would not null-terminate the resulting strings.
Add more tests to cover similar situations in which the buffer is too small to contain the complete output.
|
#
1.14 |
|
15-Feb-2024 |
rillig |
snprintb: fix out-of-bounds write
|
#
1.13 |
|
14-Feb-2024 |
rillig |
tests/libutil/snprintb_m: add tests for small line length
|
#
1.12 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: remove redundant integer constant suffixes
I added these because lint told me so. Lint was wrong though, as it had not implemented the C99 rules for integer constants.
|
#
1.11 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: fix test for 32-bit platforms
|
#
1.10 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: add more tests
Test all number bases (octal, decimal, hexadecimal), in both old-style and new-style formats, as well as small buffer sizes.
Document working edge cases such as empty descriptions or descriptions containing spaces, as well as situations that invoke undefined behavior.
Add comments to the individual test cases, as reading the actual format strings takes more time.
|
#
1.9 |
|
25-Jan-2024 |
rillig |
tests/libutil/snprintb: clean up and extend tests
In case of a failure, print the details of the test case, including file and line number of the actual test data. Do not write the format strings directly to the output, as they contain non-printable bytes and embedded null bytes.
After a failed test case, continue with the others.
Lay out the format strings according to their structure, to make them more readable. Remove redundant "\0" at the end of the new-style format strings.
Fix an off-by-one error in the test data: 0xf is FIFTEEN, not SIXTEEN.
Add a test for performing a restricted subset of rot13 in the format string, to explore the limits of snprintb formatting.
What's still missing are tests for edge cases and error cases.
|
Revision tags: netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
|
#
1.8 |
|
08-Dec-2019 |
christos |
Adjust tests for 0 hex values printing 0 instead of 0x0
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.30 |
|
04-Mar-2024 |
rillig |
snprintb: error out on unknown new-style formatting directive
|
#
1.29 |
|
24-Feb-2024 |
rillig |
tests/snprintb: clean up tests
Always write the value to be formatted in hexadecimal, to make it easily distinguishable from the buffer size and maximum line length.
Use consistent wording in the comments of the test cases. Be stricter about mistakes in a format.
Fix some wrong numbers in the snprintb_m tests for limited line length.
|
#
1.28 |
|
24-Feb-2024 |
rillig |
snprintb: allow non-ASCII descriptions on all platforms
Previously, these descriptions were only allowed on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, they invoked undefined behavior or terminated the output early.
|
#
1.27 |
|
22-Feb-2024 |
rillig |
snprintb: always null-terminate output
Always null-terminate the output in the buffer, even in error cases. The wording in the manual page has been promising this since 2008. For snprintb_m, ensure that the output is terminated with two null characters, to gracefully handle situations in which the caller does not check whether snprintb returned an error.
If the buffer size is zero, allow the buffer to be a null pointer, analogous to snprintf.
Fix an out-of-bounds memory read if the bitfmt ends with a '*' directive (since today).
In the tests, merge the helper functions for snprintb, snprintb_m, as they were similar enough.
Fix a few 'line_max exceeded' tests, ensuring that they output a '#' marker, and that the 'complete' tests don't.
|
#
1.26 |
|
22-Feb-2024 |
rillig |
snprintb: error out on out-of-bounds bit shifts
Previously, these invoked undefined behavior, now they lead to an early return. An example of out-of-bounds bit number is in SCZ_PCICTRL_BITS. Bit fields that extend beyond the msb are still allowed.
Allow 'f' and 'F' to have fields that are 64 bits wide. This only makes sense when the field starts at bit 0.
Remove the unused 'val_len', it was only needed before snprintb.c 1.20.
|
#
1.25 |
|
20-Feb-2024 |
rillig |
tests/snprintb: test '=' and '*' directives that can never match
|
#
1.24 |
|
20-Feb-2024 |
rillig |
snprintb_m: limit length of generated strings
The manual page promises that the 'max' argument limits the length of the generated strings, so don't generate any strings that are longer than that limit. Mark incomplete strings with a trailing '#' to make them easily recognizable.
|
#
1.23 |
|
20-Feb-2024 |
rillig |
tests/snprintb: fix out-of-bounds memory read (since 2024-02-16)
Before t_snprintb.c 1.20, the buffer size was required to be greater than zero. Allowing the buffer size to be zero led to buf[-1] being checked. On amd64, that byte happened to be 0, on i386 it didn't.
Fixes PR lib/57951.
|
#
1.22 |
|
19-Feb-2024 |
rillig |
snprintb: fix how named bit-fields are split into multiple lines
|
#
1.21 |
|
19-Feb-2024 |
rillig |
tests/snprintb: add more tests, especially for snprintb_m
|
#
1.20 |
|
16-Feb-2024 |
rillig |
snprintb: eliminate two local variables, allow zero-size buffer
Like snprintf, the buffer size may be zero. Unlike snprintf, the buffer must not be NULL.
|
#
1.19 |
|
16-Feb-2024 |
rillig |
snprintb: fix integer overflow when writing past a small buffer
Previously, snprintb returned -1 in this case, assuming that the snprintf used in FMTSTR validates against an overly large buffer size.
|
#
1.18 |
|
16-Feb-2024 |
rillig |
tests/snprintb: fix test for 8-bit field value
The previous version tested the behavior on a platform with signed 'char' before the portability fix.
|
#
1.17 |
|
16-Feb-2024 |
rillig |
snprintb: fix '=' and ':' for 8-bit values on platforms with signed char
Previously, '=' and ':' worked only on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, only 7-bit values worked.
|
#
1.16 |
|
16-Feb-2024 |
rillig |
tests/snprintb: clean up existing tests, add more tests
Due to the check that any bytes beyond the expected output must be unmodified, there's no need anymore to explicitly write the "ZZZ" at the end of the expected output. While here, remove the redundant trailing "\0".
Add more tests to cover possible situations where an out-of-bounds write may have occurred. In some cases, the line length specified in snprintb_m is exceeded.
|
#
1.15 |
|
15-Feb-2024 |
rillig |
snprintb: fix string termination (since today)
In the previous commit, I had accidentally only run the tests for snprintb_m but not those for snprintb, thereby missing a newly introduced bug that would not null-terminate the resulting strings.
Add more tests to cover similar situations in which the buffer is too small to contain the complete output.
|
#
1.14 |
|
15-Feb-2024 |
rillig |
snprintb: fix out-of-bounds write
|
#
1.13 |
|
14-Feb-2024 |
rillig |
tests/libutil/snprintb_m: add tests for small line length
|
#
1.12 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: remove redundant integer constant suffixes
I added these because lint told me so. Lint was wrong though, as it had not implemented the C99 rules for integer constants.
|
#
1.11 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: fix test for 32-bit platforms
|
#
1.10 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: add more tests
Test all number bases (octal, decimal, hexadecimal), in both old-style and new-style formats, as well as small buffer sizes.
Document working edge cases such as empty descriptions or descriptions containing spaces, as well as situations that invoke undefined behavior.
Add comments to the individual test cases, as reading the actual format strings takes more time.
|
#
1.9 |
|
25-Jan-2024 |
rillig |
tests/libutil/snprintb: clean up and extend tests
In case of a failure, print the details of the test case, including file and line number of the actual test data. Do not write the format strings directly to the output, as they contain non-printable bytes and embedded null bytes.
After a failed test case, continue with the others.
Lay out the format strings according to their structure, to make them more readable. Remove redundant "\0" at the end of the new-style format strings.
Fix an off-by-one error in the test data: 0xf is FIFTEEN, not SIXTEEN.
Add a test for performing a restricted subset of rot13 in the format string, to explore the limits of snprintb formatting.
What's still missing are tests for edge cases and error cases.
|
Revision tags: netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
|
#
1.8 |
|
08-Dec-2019 |
christos |
Adjust tests for 0 hex values printing 0 instead of 0x0
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.29 |
|
24-Feb-2024 |
rillig |
tests/snprintb: clean up tests
Always write the value to be formatted in hexadecimal, to make it easily distinguishable from the buffer size and maximum line length.
Use consistent wording in the comments of the test cases. Be stricter about mistakes in a format.
Fix some wrong numbers in the snprintb_m tests for limited line length.
|
#
1.28 |
|
24-Feb-2024 |
rillig |
snprintb: allow non-ASCII descriptions on all platforms
Previously, these descriptions were only allowed on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, they invoked undefined behavior or terminated the output early.
|
#
1.27 |
|
22-Feb-2024 |
rillig |
snprintb: always null-terminate output
Always null-terminate the output in the buffer, even in error cases. The wording in the manual page has been promising this since 2008. For snprintb_m, ensure that the output is terminated with two null characters, to gracefully handle situations in which the caller does not check whether snprintb returned an error.
If the buffer size is zero, allow the buffer to be a null pointer, analogous to snprintf.
Fix an out-of-bounds memory read if the bitfmt ends with a '*' directive (since today).
In the tests, merge the helper functions for snprintb, snprintb_m, as they were similar enough.
Fix a few 'line_max exceeded' tests, ensuring that they output a '#' marker, and that the 'complete' tests don't.
|
#
1.26 |
|
22-Feb-2024 |
rillig |
snprintb: error out on out-of-bounds bit shifts
Previously, these invoked undefined behavior, now they lead to an early return. An example of out-of-bounds bit number is in SCZ_PCICTRL_BITS. Bit fields that extend beyond the msb are still allowed.
Allow 'f' and 'F' to have fields that are 64 bits wide. This only makes sense when the field starts at bit 0.
Remove the unused 'val_len', it was only needed before snprintb.c 1.20.
|
#
1.25 |
|
20-Feb-2024 |
rillig |
tests/snprintb: test '=' and '*' directives that can never match
|
#
1.24 |
|
20-Feb-2024 |
rillig |
snprintb_m: limit length of generated strings
The manual page promises that the 'max' argument limits the length of the generated strings, so don't generate any strings that are longer than that limit. Mark incomplete strings with a trailing '#' to make them easily recognizable.
|
#
1.23 |
|
20-Feb-2024 |
rillig |
tests/snprintb: fix out-of-bounds memory read (since 2024-02-16)
Before t_snprintb.c 1.20, the buffer size was required to be greater than zero. Allowing the buffer size to be zero led to buf[-1] being checked. On amd64, that byte happened to be 0, on i386 it didn't.
Fixes PR lib/57951.
|
#
1.22 |
|
19-Feb-2024 |
rillig |
snprintb: fix how named bit-fields are split into multiple lines
|
#
1.21 |
|
19-Feb-2024 |
rillig |
tests/snprintb: add more tests, especially for snprintb_m
|
#
1.20 |
|
16-Feb-2024 |
rillig |
snprintb: eliminate two local variables, allow zero-size buffer
Like snprintf, the buffer size may be zero. Unlike snprintf, the buffer must not be NULL.
|
#
1.19 |
|
16-Feb-2024 |
rillig |
snprintb: fix integer overflow when writing past a small buffer
Previously, snprintb returned -1 in this case, assuming that the snprintf used in FMTSTR validates against an overly large buffer size.
|
#
1.18 |
|
16-Feb-2024 |
rillig |
tests/snprintb: fix test for 8-bit field value
The previous version tested the behavior on a platform with signed 'char' before the portability fix.
|
#
1.17 |
|
16-Feb-2024 |
rillig |
snprintb: fix '=' and ':' for 8-bit values on platforms with signed char
Previously, '=' and ':' worked only on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, only 7-bit values worked.
|
#
1.16 |
|
16-Feb-2024 |
rillig |
tests/snprintb: clean up existing tests, add more tests
Due to the check that any bytes beyond the expected output must be unmodified, there's no need anymore to explicitly write the "ZZZ" at the end of the expected output. While here, remove the redundant trailing "\0".
Add more tests to cover possible situations where an out-of-bounds write may have occurred. In some cases, the line length specified in snprintb_m is exceeded.
|
#
1.15 |
|
15-Feb-2024 |
rillig |
snprintb: fix string termination (since today)
In the previous commit, I had accidentally only run the tests for snprintb_m but not those for snprintb, thereby missing a newly introduced bug that would not null-terminate the resulting strings.
Add more tests to cover similar situations in which the buffer is too small to contain the complete output.
|
#
1.14 |
|
15-Feb-2024 |
rillig |
snprintb: fix out-of-bounds write
|
#
1.13 |
|
14-Feb-2024 |
rillig |
tests/libutil/snprintb_m: add tests for small line length
|
#
1.12 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: remove redundant integer constant suffixes
I added these because lint told me so. Lint was wrong though, as it had not implemented the C99 rules for integer constants.
|
#
1.11 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: fix test for 32-bit platforms
|
#
1.10 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: add more tests
Test all number bases (octal, decimal, hexadecimal), in both old-style and new-style formats, as well as small buffer sizes.
Document working edge cases such as empty descriptions or descriptions containing spaces, as well as situations that invoke undefined behavior.
Add comments to the individual test cases, as reading the actual format strings takes more time.
|
#
1.9 |
|
25-Jan-2024 |
rillig |
tests/libutil/snprintb: clean up and extend tests
In case of a failure, print the details of the test case, including file and line number of the actual test data. Do not write the format strings directly to the output, as they contain non-printable bytes and embedded null bytes.
After a failed test case, continue with the others.
Lay out the format strings according to their structure, to make them more readable. Remove redundant "\0" at the end of the new-style format strings.
Fix an off-by-one error in the test data: 0xf is FIFTEEN, not SIXTEEN.
Add a test for performing a restricted subset of rot13 in the format string, to explore the limits of snprintb formatting.
What's still missing are tests for edge cases and error cases.
|
Revision tags: netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
|
#
1.8 |
|
08-Dec-2019 |
christos |
Adjust tests for 0 hex values printing 0 instead of 0x0
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.27 |
|
22-Feb-2024 |
rillig |
snprintb: always null-terminate output
Always null-terminate the output in the buffer, even in error cases. The wording in the manual page has been promising this since 2008. For snprintb_m, ensure that the output is terminated with two null characters, to gracefully handle situations in which the caller does not check whether snprintb returned an error.
If the buffer size is zero, allow the buffer to be a null pointer, analogous to snprintf.
Fix an out-of-bounds memory read if the bitfmt ends with a '*' directive (since today).
In the tests, merge the helper functions for snprintb, snprintb_m, as they were similar enough.
Fix a few 'line_max exceeded' tests, ensuring that they output a '#' marker, and that the 'complete' tests don't.
|
#
1.26 |
|
22-Feb-2024 |
rillig |
snprintb: error out on out-of-bounds bit shifts
Previously, these invoked undefined behavior, now they lead to an early return. An example of out-of-bounds bit number is in SCZ_PCICTRL_BITS. Bit fields that extend beyond the msb are still allowed.
Allow 'f' and 'F' to have fields that are 64 bits wide. This only makes sense when the field starts at bit 0.
Remove the unused 'val_len', it was only needed before snprintb.c 1.20.
|
#
1.25 |
|
20-Feb-2024 |
rillig |
tests/snprintb: test '=' and '*' directives that can never match
|
#
1.24 |
|
20-Feb-2024 |
rillig |
snprintb_m: limit length of generated strings
The manual page promises that the 'max' argument limits the length of the generated strings, so don't generate any strings that are longer than that limit. Mark incomplete strings with a trailing '#' to make them easily recognizable.
|
#
1.23 |
|
20-Feb-2024 |
rillig |
tests/snprintb: fix out-of-bounds memory read (since 2024-02-16)
Before t_snprintb.c 1.20, the buffer size was required to be greater than zero. Allowing the buffer size to be zero led to buf[-1] being checked. On amd64, that byte happened to be 0, on i386 it didn't.
Fixes PR lib/57951.
|
#
1.22 |
|
19-Feb-2024 |
rillig |
snprintb: fix how named bit-fields are split into multiple lines
|
#
1.21 |
|
19-Feb-2024 |
rillig |
tests/snprintb: add more tests, especially for snprintb_m
|
#
1.20 |
|
16-Feb-2024 |
rillig |
snprintb: eliminate two local variables, allow zero-size buffer
Like snprintf, the buffer size may be zero. Unlike snprintf, the buffer must not be NULL.
|
#
1.19 |
|
16-Feb-2024 |
rillig |
snprintb: fix integer overflow when writing past a small buffer
Previously, snprintb returned -1 in this case, assuming that the snprintf used in FMTSTR validates against an overly large buffer size.
|
#
1.18 |
|
16-Feb-2024 |
rillig |
tests/snprintb: fix test for 8-bit field value
The previous version tested the behavior on a platform with signed 'char' before the portability fix.
|
#
1.17 |
|
16-Feb-2024 |
rillig |
snprintb: fix '=' and ':' for 8-bit values on platforms with signed char
Previously, '=' and ':' worked only on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, only 7-bit values worked.
|
#
1.16 |
|
16-Feb-2024 |
rillig |
tests/snprintb: clean up existing tests, add more tests
Due to the check that any bytes beyond the expected output must be unmodified, there's no need anymore to explicitly write the "ZZZ" at the end of the expected output. While here, remove the redundant trailing "\0".
Add more tests to cover possible situations where an out-of-bounds write may have occurred. In some cases, the line length specified in snprintb_m is exceeded.
|
#
1.15 |
|
15-Feb-2024 |
rillig |
snprintb: fix string termination (since today)
In the previous commit, I had accidentally only run the tests for snprintb_m but not those for snprintb, thereby missing a newly introduced bug that would not null-terminate the resulting strings.
Add more tests to cover similar situations in which the buffer is too small to contain the complete output.
|
#
1.14 |
|
15-Feb-2024 |
rillig |
snprintb: fix out-of-bounds write
|
#
1.13 |
|
14-Feb-2024 |
rillig |
tests/libutil/snprintb_m: add tests for small line length
|
#
1.12 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: remove redundant integer constant suffixes
I added these because lint told me so. Lint was wrong though, as it had not implemented the C99 rules for integer constants.
|
#
1.11 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: fix test for 32-bit platforms
|
#
1.10 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: add more tests
Test all number bases (octal, decimal, hexadecimal), in both old-style and new-style formats, as well as small buffer sizes.
Document working edge cases such as empty descriptions or descriptions containing spaces, as well as situations that invoke undefined behavior.
Add comments to the individual test cases, as reading the actual format strings takes more time.
|
#
1.9 |
|
25-Jan-2024 |
rillig |
tests/libutil/snprintb: clean up and extend tests
In case of a failure, print the details of the test case, including file and line number of the actual test data. Do not write the format strings directly to the output, as they contain non-printable bytes and embedded null bytes.
After a failed test case, continue with the others.
Lay out the format strings according to their structure, to make them more readable. Remove redundant "\0" at the end of the new-style format strings.
Fix an off-by-one error in the test data: 0xf is FIFTEEN, not SIXTEEN.
Add a test for performing a restricted subset of rot13 in the format string, to explore the limits of snprintb formatting.
What's still missing are tests for edge cases and error cases.
|
Revision tags: netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
|
#
1.8 |
|
08-Dec-2019 |
christos |
Adjust tests for 0 hex values printing 0 instead of 0x0
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.25 |
|
20-Feb-2024 |
rillig |
tests/snprintb: test '=' and '*' directives that can never match
|
#
1.24 |
|
20-Feb-2024 |
rillig |
snprintb_m: limit length of generated strings
The manual page promises that the 'max' argument limits the length of the generated strings, so don't generate any strings that are longer than that limit. Mark incomplete strings with a trailing '#' to make them easily recognizable.
|
#
1.23 |
|
20-Feb-2024 |
rillig |
tests/snprintb: fix out-of-bounds memory read (since 2024-02-16)
Before t_snprintb.c 1.20, the buffer size was required to be greater than zero. Allowing the buffer size to be zero led to buf[-1] being checked. On amd64, that byte happened to be 0, on i386 it didn't.
Fixes PR lib/57951.
|
#
1.22 |
|
19-Feb-2024 |
rillig |
snprintb: fix how named bit-fields are split into multiple lines
|
#
1.21 |
|
19-Feb-2024 |
rillig |
tests/snprintb: add more tests, especially for snprintb_m
|
#
1.20 |
|
16-Feb-2024 |
rillig |
snprintb: eliminate two local variables, allow zero-size buffer
Like snprintf, the buffer size may be zero. Unlike snprintf, the buffer must not be NULL.
|
#
1.19 |
|
16-Feb-2024 |
rillig |
snprintb: fix integer overflow when writing past a small buffer
Previously, snprintb returned -1 in this case, assuming that the snprintf used in FMTSTR validates against an overly large buffer size.
|
#
1.18 |
|
16-Feb-2024 |
rillig |
tests/snprintb: fix test for 8-bit field value
The previous version tested the behavior on a platform with signed 'char' before the portability fix.
|
#
1.17 |
|
16-Feb-2024 |
rillig |
snprintb: fix '=' and ':' for 8-bit values on platforms with signed char
Previously, '=' and ':' worked only on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, only 7-bit values worked.
|
#
1.16 |
|
16-Feb-2024 |
rillig |
tests/snprintb: clean up existing tests, add more tests
Due to the check that any bytes beyond the expected output must be unmodified, there's no need anymore to explicitly write the "ZZZ" at the end of the expected output. While here, remove the redundant trailing "\0".
Add more tests to cover possible situations where an out-of-bounds write may have occurred. In some cases, the line length specified in snprintb_m is exceeded.
|
#
1.15 |
|
15-Feb-2024 |
rillig |
snprintb: fix string termination (since today)
In the previous commit, I had accidentally only run the tests for snprintb_m but not those for snprintb, thereby missing a newly introduced bug that would not null-terminate the resulting strings.
Add more tests to cover similar situations in which the buffer is too small to contain the complete output.
|
#
1.14 |
|
15-Feb-2024 |
rillig |
snprintb: fix out-of-bounds write
|
#
1.13 |
|
14-Feb-2024 |
rillig |
tests/libutil/snprintb_m: add tests for small line length
|
#
1.12 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: remove redundant integer constant suffixes
I added these because lint told me so. Lint was wrong though, as it had not implemented the C99 rules for integer constants.
|
#
1.11 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: fix test for 32-bit platforms
|
#
1.10 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: add more tests
Test all number bases (octal, decimal, hexadecimal), in both old-style and new-style formats, as well as small buffer sizes.
Document working edge cases such as empty descriptions or descriptions containing spaces, as well as situations that invoke undefined behavior.
Add comments to the individual test cases, as reading the actual format strings takes more time.
|
#
1.9 |
|
25-Jan-2024 |
rillig |
tests/libutil/snprintb: clean up and extend tests
In case of a failure, print the details of the test case, including file and line number of the actual test data. Do not write the format strings directly to the output, as they contain non-printable bytes and embedded null bytes.
After a failed test case, continue with the others.
Lay out the format strings according to their structure, to make them more readable. Remove redundant "\0" at the end of the new-style format strings.
Fix an off-by-one error in the test data: 0xf is FIFTEEN, not SIXTEEN.
Add a test for performing a restricted subset of rot13 in the format string, to explore the limits of snprintb formatting.
What's still missing are tests for edge cases and error cases.
|
Revision tags: netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
|
#
1.8 |
|
08-Dec-2019 |
christos |
Adjust tests for 0 hex values printing 0 instead of 0x0
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.20 |
|
16-Feb-2024 |
rillig |
snprintb: eliminate two local variables, allow zero-size buffer
Like snprintf, the buffer size may be zero. Unlike snprintf, the buffer must not be NULL.
|
#
1.19 |
|
16-Feb-2024 |
rillig |
snprintb: fix integer overflow when writing past a small buffer
Previously, snprintb returned -1 in this case, assuming that the snprintf used in FMTSTR validates against an overly large buffer size.
|
#
1.18 |
|
16-Feb-2024 |
rillig |
tests/snprintb: fix test for 8-bit field value
The previous version tested the behavior on a platform with signed 'char' before the portability fix.
|
#
1.17 |
|
16-Feb-2024 |
rillig |
snprintb: fix '=' and ':' for 8-bit values on platforms with signed char
Previously, '=' and ':' worked only on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, only 7-bit values worked.
|
#
1.16 |
|
16-Feb-2024 |
rillig |
tests/snprintb: clean up existing tests, add more tests
Due to the check that any bytes beyond the expected output must be unmodified, there's no need anymore to explicitly write the "ZZZ" at the end of the expected output. While here, remove the redundant trailing "\0".
Add more tests to cover possible situations where an out-of-bounds write may have occurred. In some cases, the line length specified in snprintb_m is exceeded.
|
#
1.15 |
|
15-Feb-2024 |
rillig |
snprintb: fix string termination (since today)
In the previous commit, I had accidentally only run the tests for snprintb_m but not those for snprintb, thereby missing a newly introduced bug that would not null-terminate the resulting strings.
Add more tests to cover similar situations in which the buffer is too small to contain the complete output.
|
#
1.14 |
|
15-Feb-2024 |
rillig |
snprintb: fix out-of-bounds write
|
#
1.13 |
|
14-Feb-2024 |
rillig |
tests/libutil/snprintb_m: add tests for small line length
|
#
1.12 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: remove redundant integer constant suffixes
I added these because lint told me so. Lint was wrong though, as it had not implemented the C99 rules for integer constants.
|
#
1.11 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: fix test for 32-bit platforms
|
#
1.10 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: add more tests
Test all number bases (octal, decimal, hexadecimal), in both old-style and new-style formats, as well as small buffer sizes.
Document working edge cases such as empty descriptions or descriptions containing spaces, as well as situations that invoke undefined behavior.
Add comments to the individual test cases, as reading the actual format strings takes more time.
|
#
1.9 |
|
25-Jan-2024 |
rillig |
tests/libutil/snprintb: clean up and extend tests
In case of a failure, print the details of the test case, including file and line number of the actual test data. Do not write the format strings directly to the output, as they contain non-printable bytes and embedded null bytes.
After a failed test case, continue with the others.
Lay out the format strings according to their structure, to make them more readable. Remove redundant "\0" at the end of the new-style format strings.
Fix an off-by-one error in the test data: 0xf is FIFTEEN, not SIXTEEN.
Add a test for performing a restricted subset of rot13 in the format string, to explore the limits of snprintb formatting.
What's still missing are tests for edge cases and error cases.
|
Revision tags: netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
|
#
1.8 |
|
08-Dec-2019 |
christos |
Adjust tests for 0 hex values printing 0 instead of 0x0
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.20 |
|
16-Feb-2024 |
rillig |
snprintb: eliminate two local variables, allow zero-size buffer
Like snprintf, the buffer size may be zero. Unlike snprintf, the buffer must not be NULL.
|
#
1.19 |
|
16-Feb-2024 |
rillig |
snprintb: fix integer overflow when writing past a small buffer
Previously, snprintb returned -1 in this case, assuming that the snprintf used in FMTSTR validates against an overly large buffer size.
|
#
1.18 |
|
16-Feb-2024 |
rillig |
tests/snprintb: fix test for 8-bit field value
The previous version tested the behavior on a platform with signed 'char' before the portability fix.
|
#
1.17 |
|
16-Feb-2024 |
rillig |
snprintb: fix '=' and ':' for 8-bit values on platforms with signed char
Previously, '=' and ':' worked only on platforms where plain 'char' is unsigned. On platforms where plain 'char' is signed, only 7-bit values worked.
|
#
1.16 |
|
16-Feb-2024 |
rillig |
tests/snprintb: clean up existing tests, add more tests
Due to the check that any bytes beyond the expected output must be unmodified, there's no need anymore to explicitly write the "ZZZ" at the end of the expected output. While here, remove the redundant trailing "\0".
Add more tests to cover possible situations where an out-of-bounds write may have occurred. In some cases, the line length specified in snprintb_m is exceeded.
|
#
1.15 |
|
15-Feb-2024 |
rillig |
snprintb: fix string termination (since today)
In the previous commit, I had accidentally only run the tests for snprintb_m but not those for snprintb, thereby missing a newly introduced bug that would not null-terminate the resulting strings.
Add more tests to cover similar situations in which the buffer is too small to contain the complete output.
|
#
1.14 |
|
15-Feb-2024 |
rillig |
snprintb: fix out-of-bounds write
|
#
1.13 |
|
14-Feb-2024 |
rillig |
tests/libutil/snprintb_m: add tests for small line length
|
#
1.12 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: remove redundant integer constant suffixes
I added these because lint told me so. Lint was wrong though, as it had not implemented the C99 rules for integer constants.
|
#
1.11 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: fix test for 32-bit platforms
|
#
1.10 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: add more tests
Test all number bases (octal, decimal, hexadecimal), in both old-style and new-style formats, as well as small buffer sizes.
Document working edge cases such as empty descriptions or descriptions containing spaces, as well as situations that invoke undefined behavior.
Add comments to the individual test cases, as reading the actual format strings takes more time.
|
#
1.9 |
|
25-Jan-2024 |
rillig |
tests/libutil/snprintb: clean up and extend tests
In case of a failure, print the details of the test case, including file and line number of the actual test data. Do not write the format strings directly to the output, as they contain non-printable bytes and embedded null bytes.
After a failed test case, continue with the others.
Lay out the format strings according to their structure, to make them more readable. Remove redundant "\0" at the end of the new-style format strings.
Fix an off-by-one error in the test data: 0xf is FIFTEEN, not SIXTEEN.
Add a test for performing a restricted subset of rot13 in the format string, to explore the limits of snprintb formatting.
What's still missing are tests for edge cases and error cases.
|
Revision tags: netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
|
#
1.8 |
|
08-Dec-2019 |
christos |
Adjust tests for 0 hex values printing 0 instead of 0x0
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.12 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: remove redundant integer constant suffixes
I added these because lint told me so. Lint was wrong though, as it had not implemented the C99 rules for integer constants.
|
#
1.11 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: fix test for 32-bit platforms
|
#
1.10 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: add more tests
Test all number bases (octal, decimal, hexadecimal), in both old-style and new-style formats, as well as small buffer sizes.
Document working edge cases such as empty descriptions or descriptions containing spaces, as well as situations that invoke undefined behavior.
Add comments to the individual test cases, as reading the actual format strings takes more time.
|
#
1.9 |
|
25-Jan-2024 |
rillig |
tests/libutil/snprintb: clean up and extend tests
In case of a failure, print the details of the test case, including file and line number of the actual test data. Do not write the format strings directly to the output, as they contain non-printable bytes and embedded null bytes.
After a failed test case, continue with the others.
Lay out the format strings according to their structure, to make them more readable. Remove redundant "\0" at the end of the new-style format strings.
Fix an off-by-one error in the test data: 0xf is FIFTEEN, not SIXTEEN.
Add a test for performing a restricted subset of rot13 in the format string, to explore the limits of snprintb formatting.
What's still missing are tests for edge cases and error cases.
|
Revision tags: netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
|
#
1.8 |
|
08-Dec-2019 |
christos |
Adjust tests for 0 hex values printing 0 instead of 0x0
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.12 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: remove redundant integer constant suffixes
I added these because lint told me so. Lint was wrong though, as it had not implemented the C99 rules for integer constants.
|
#
1.11 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: fix test for 32-bit platforms
|
#
1.10 |
|
27-Jan-2024 |
rillig |
tests/libutil/snprintb: add more tests
Test all number bases (octal, decimal, hexadecimal), in both old-style and new-style formats, as well as small buffer sizes.
Document working edge cases such as empty descriptions or descriptions containing spaces, as well as situations that invoke undefined behavior.
Add comments to the individual test cases, as reading the actual format strings takes more time.
|
#
1.9 |
|
25-Jan-2024 |
rillig |
tests/libutil/snprintb: clean up and extend tests
In case of a failure, print the details of the test case, including file and line number of the actual test data. Do not write the format strings directly to the output, as they contain non-printable bytes and embedded null bytes.
After a failed test case, continue with the others.
Lay out the format strings according to their structure, to make them more readable. Remove redundant "\0" at the end of the new-style format strings.
Fix an off-by-one error in the test data: 0xf is FIFTEEN, not SIXTEEN.
Add a test for performing a restricted subset of rot13 in the format string, to explore the limits of snprintb formatting.
What's still missing are tests for edge cases and error cases.
|
Revision tags: netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406
|
#
1.8 |
|
08-Dec-2019 |
christos |
Adjust tests for 0 hex values printing 0 instead of 0x0
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.8 |
|
08-Dec-2019 |
christos |
Adjust tests for 0 hex values printing 0 instead of 0x0
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.7 |
|
06-Dec-2019 |
christos |
Fix broken tests in big endian machines. Internally field values are stored as uint64_t/uintmax_t so printing them with %d on big endian ends up being 0.
|
Revision tags: netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
branches: 1.5.4; add test case for new format 'f' and 'F'
|
Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|
#
1.6 |
|
29-Apr-2019 |
kre |
snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0 The F spec is one of those, it should be terminated with \0 just like all the others (irrelevant that it has no extra data to delimit).
Fix <sys/mman.h> to define the snprintb() format string correctly (include the missing \0's). Fix the copy of that definition included into snprintb(3) to match the updated mman.h version (ride the date bump from the day before yesterday .. this is the same change, just corrected).
Undo the previous snprintb.c change ("off by one" fix) which was an attempt to make the broken mman.h usage work (and did, but not the way it should be done). Also, after using the new * format (instead of only when something has already matched) skip the associated data so we don't attempt to interpret it as more field specifiers. This func needs lots of TLC!
Fix the ATF tests for snprintb() to not assume that F format is really exactly like f format, and has data after the field specifier. It doesn't. Add several more tests (including testing the '*' field operator recently added).
|
Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
|
#
1.5 |
|
14-Oct-2017 |
ryo |
add test case for new format 'f' and 'F'
|
Revision tags: netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
|
#
1.4 |
|
06-Jun-2014 |
shm |
PR/48517 testcase provided by Felix Deichmann
|
Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
|
#
1.3 |
|
08-Aug-2013 |
pgoyette |
branches: 1.3.2; Arghhh! Typo.
|
#
1.2 |
|
08-Aug-2013 |
pgoyette |
Add a new test case for snprintb_m(3) to catch previous boundary bug.
|
Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
|
#
1.1 |
|
16-Jul-2010 |
jmmv |
branches: 1.1.6; 1.1.12; Convert the libposix, libprop, librt, libskey and libutil tests to ATF. Initial work from the GSoC 2008 project by Lukasz Strzygowski.
|