]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
od: reinstate half float validation check
authorPádraig Brady <P@draigBrady.com>
Mon, 30 Jun 2025 13:25:56 +0000 (14:25 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 30 Jun 2025 13:34:55 +0000 (14:34 +0100)
Reinstate check removed in commit 56aa549a0 so that we
disallow -f2 when configured with utils_cv_ieee_16_bit_supported=no.
Otherwise the output routines will consume floats,
i.e. 4 bytes at a time.  Without this extra check
the tests/od/od-endian.sh will fail with this configuration.

* src/od.c (decode_one_format): Reinstate the explicit check
for this configuration edge case.

src/od.c

index 700470b8536ed6d76eb8b387a787508f677d2453..24e981cb062911832b40a152be8f8fd8a7fca481 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -871,7 +871,9 @@ decode_one_format (char const *s_orig, char const *s, char const **next,
           else
             {
               if (ARRAY_CARDINALITY (fp_type_size) <= size
-                  || fp_type_size[size] == NO_SIZE)
+                  || fp_type_size[size] == NO_SIZE
+                  || (! FLOAT16_SUPPORTED && BF16_SUPPORTED
+                      && size == sizeof (bfloat16)))
                 {
                   error (0, 0,
                          _("invalid type string %s;\n"