From 7b487d9146dba07d2e71c27fd3033587c09766b0 Mon Sep 17 00:00:00 2001 From: Scott Boudreaux <121303252+Scottcjn@users.noreply.github.com> Date: Fri, 26 Jun 2026 17:36:46 +0000 Subject: [PATCH] Core: byte-swap the float vector data, not the attribute struct extract_attr_float_vector reads the float array into attrdata->arr, then called priv_to_native32(attrdata, n). On big-endian hosts that swaps the first n 32-bit words of the exr_attr_float_vector_t struct itself (the arr pointer and length) instead of the n floats in attrdata->arr. The corrupted pointer and length then crash when the value is read back, for example a std::bad_alloc or segfault while constructing the FloatVector in the C++ Context::header path. Swap attrdata->arr instead. priv_to_native32 is a no-op on little-endian, so x86_64 and ppc64le are unaffected. Verified on POWER8: OpenEXR.testAttributes segfaults on big-endian ppc64 before this change and passes after. Signed-off-by: Scott Boudreaux <121303252+Scottcjn@users.noreply.github.com> --- src/lib/OpenEXRCore/parse_header.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/OpenEXRCore/parse_header.c b/src/lib/OpenEXRCore/parse_header.c index 575707d0e..af0fd2569 100644 --- a/src/lib/OpenEXRCore/parse_header.c +++ b/src/lib/OpenEXRCore/parse_header.c @@ -557,7 +557,7 @@ extract_attr_float_vector ( tname); } - priv_to_native32 (attrdata, n); + priv_to_native32 (attrdata->arr, n); } return rv;