]> git.ipfire.org Git - thirdparty/openssl.git/commit
test/bioprinttest.c: move the %n result to the field that is later checked
authorEugene Syromiatnikov <esyr@openssl.org>
Fri, 29 Aug 2025 17:45:07 +0000 (19:45 +0200)
committerNeil Horman <nhorman@openssl.org>
Fri, 29 Aug 2025 21:20:26 +0000 (17:20 -0400)
commit0b00e23df82af08ba04f482745bd7ddbff2da34b
treead63d9da39095b7476ffcd35d7d774d0dba5b6c5
parente489bfbcd58b8ac91e108c6bb669bf5f07217b2c
test/bioprinttest.c: move the %n result to the field that is later checked

The test_n test implicitly assumed a certain union layout, as the %n was
writing to the union field in accordance with the length modifier being
tested, but comparison of the expected value was dan agains the val field,
and that is incorrect, especially on big-endian architectures.  Fix that
by explicitly assigning the result to the val field of the union and
updating the expected values where the resulting value overflows
into negative.

Fixes: 9deaf8383338 "test/bioprinttest.c: add some checks for integer and string printing"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28388)
test/bioprinttest.c