From: Eugene Syromiatnikov Date: Fri, 29 Aug 2025 17:39:53 +0000 (+0200) Subject: test/bioprinttest.c: fix sloppy length modifier usage in int_data X-Git-Tag: openssl-3.6.0-alpha1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e489bfbcd58b8ac91e108c6bb669bf5f07217b2c;p=thirdparty%2Fopenssl.git test/bioprinttest.c: fix sloppy length modifier usage in int_data Some test vectors used in int_data have mismatching (or, more spercifically) missing length modifiers in conversion specifiers; most of the time it has gone unnoticed, but on some architectures where 64-bit arguments supplied differently (sugh as mips and armv7) it led to garbage being retrieved instead of the expected values. Fix it by properly providing proper length modifiers. Fixes: 9deaf8383338 "test/bioprinttest.c: add some checks for integer and string printing" Signed-off-by: Eugene Syromiatnikov Reviewed-by: Neil Horman Reviewed-by: Saša Nedvědický (Merged from https://github.com/openssl/openssl/pull/28388) --- diff --git a/test/bioprinttest.c b/test/bioprinttest.c index f62304e381b..29acddac405 100644 --- a/test/bioprinttest.c +++ b/test/bioprinttest.c @@ -159,7 +159,7 @@ static const struct int_data { { { .hh = 0x95 }, AT_CHAR, "%#06hhi", "-00107" }, { { .hh = 0x4 }, AT_CHAR, "%# hhd", " 4" }, { { .hh = 0x3 }, AT_CHAR, "%# hhu", "3" }, - { { .hh = 0x0 }, AT_CHAR, "%02x", "00" }, + { { .hh = 0x0 }, AT_CHAR, "%02hhx", "00" }, { { .h = 0 }, AT_SHORT, "|%.0hd|", "||" }, { { .h = 0 }, AT_SHORT, "|%.hu|", "||" }, { { .h = 0 }, AT_SHORT, "|%#.ho|", "|0|" }, @@ -215,16 +215,16 @@ static const struct int_data { { { .i = 0x1337 }, AT_INT, "%4294967302.x", "", .skip_libc_check = true, .exp_ret = -1 }, { { .i = 0xbeeface }, AT_INT, "%#+-12.1d", "+200211150 " }, - { { .l = 0 }, AT_LONG, "%%%#.0o%%", "%0%" }, - { { .l = 0 }, AT_LONG, "%%%.0o%%", "%%" }, - { { .l = 0 }, AT_LONG, "%%%-.0o%%", "%%" }, - { { .l = 0xfacefed }, AT_LONG, "%#-1.14d", "00000262991853" }, - { { .l = 0xdefaced }, AT_LONG, "%#+-014.11i", "+00233811181 " }, - { { .l = 0xfacade }, AT_LONG, "%#0.14o", "00000076545336" }, - { { .l = 0 }, AT_LONG, "%#0.14o", "00000000000000" }, - { { .l = 0xfacade }, AT_LONG, "%#0.14x", "0x00000000facade" }, - { { .ll = 0 }, AT_LLONG, "#%#.0x#", "##" }, - { { .ll = 0 }, AT_LLONG, "#%.0x#", "##" }, + { { .l = 0 }, AT_LONG, "%%%#.0lo%%", "%0%" }, + { { .l = 0 }, AT_LONG, "%%%.0lo%%", "%%" }, + { { .l = 0 }, AT_LONG, "%%%-.0lo%%", "%%" }, + { { .l = 0xfacefed }, AT_LONG, "%#-1.14ld", "00000262991853" }, + { { .l = 0xdefaced }, AT_LONG, "%#+-014.11li", "+00233811181 " }, + { { .l = 0xfacade }, AT_LONG, "%#0.14lo", "00000076545336" }, + { { .l = 0 }, AT_LONG, "%#0.14lo", "00000000000000" }, + { { .l = 0xfacade }, AT_LONG, "%#0.14lx", "0x00000000facade" }, + { { .ll = 0 }, AT_LLONG, "#%#.0llx#", "##" }, + { { .ll = 0 }, AT_LLONG, "#%.0llx#", "##" }, { { .ll = 0xffffFFFFffffFFFFULL }, AT_LLONG, "%#-032llo", "01777777777777777777777 " }, { { .ll = 0xbadc0deddeadfaceULL }, AT_LLONG, "%022lld",