summaryrefslogtreecommitdiffstatshomepage
path: root/unix/coverage.c
diff options
context:
space:
mode:
authorDelio Brignoli <brignoli.delio@gmail.com>2016-08-20 10:51:28 +0200
committerDamien George <damien.p.george@gmail.com>2016-09-01 18:09:44 +1000
commitf98bb2ddcbfed7033ae93ae8fe98b0540a9fb42f (patch)
treee0cc5f6fb0d9ff1124ae99b360fde5dd59c660b9 /unix/coverage.c
parentce1c786297e69df4a82e83ac379f8ef068e709f6 (diff)
downloadmicropython-f98bb2ddcbfed7033ae93ae8fe98b0540a9fb42f.tar.gz
micropython-f98bb2ddcbfed7033ae93ae8fe98b0540a9fb42f.zip
py/mpprint: Fail an assertion with unsupported format specifiers.
Arguments of an unknown type cannot be skipped and continuing to parse a format string after encountering an unknown format specifier leads to undefined behaviour. This patch helps to find use of unsupported formats.
Diffstat (limited to 'unix/coverage.c')
-rw-r--r--unix/coverage.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/unix/coverage.c b/unix/coverage.c
index 9d53725543..ce1da50e2f 100644
--- a/unix/coverage.c
+++ b/unix/coverage.c
@@ -12,7 +12,6 @@ STATIC mp_obj_t extra_coverage(void) {
// mp_printf (used by ports that don't have a native printf)
{
mp_printf(&mp_plat_print, "# mp_printf\n");
- mp_printf(&mp_plat_print, "%"); // nothing after percent
mp_printf(&mp_plat_print, "%d %+d % d\n", -123, 123, 123); // sign
mp_printf(&mp_plat_print, "%05d\n", -123); // negative number with zero padding
mp_printf(&mp_plat_print, "%ld\n", 123); // long
@@ -21,7 +20,6 @@ STATIC mp_obj_t extra_coverage(void) {
mp_printf(&mp_plat_print, "%.*s\n", -1, "abc"); // negative string precision
mp_printf(&mp_plat_print, "%b %b\n", 0, 1); // bools
mp_printf(&mp_plat_print, "%s\n", NULL); // null string
- mp_printf(&mp_plat_print, "%t\n"); // non-format char
mp_printf(&mp_plat_print, "%d\n", 0x80000000); // should print signed
mp_printf(&mp_plat_print, "%u\n", 0x80000000); // should print unsigned
mp_printf(&mp_plat_print, "%x\n", 0x80000000); // should print unsigned