From 8b2780225696ae42f4b9eeb1ac8151291f53ba5c Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Thu, 15 Jan 2026 14:00:19 +0100 Subject: [PATCH] Fix off-by-one error in native_image_p * src/image.c (native_image_format): Make array size explicit, to help keep it consistent with its later fmt descriptor copy. (native_image_p): Parse the correct number of keywords (bug#80191). --- src/image.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/image.c b/src/image.c index 4fdee9bbd9c..3dad672515c 100644 --- a/src/image.c +++ b/src/image.c @@ -7867,7 +7867,7 @@ enum native_image_keyword_index /* Vector of image_keyword structures describing the format of valid user-defined image specifications. */ -static const struct image_keyword native_image_format[] = +static const struct image_keyword native_image_format[NATIVE_IMAGE_LAST] = { {":type", IMAGE_SYMBOL_VALUE, 1}, {":data", IMAGE_STRING_VALUE, 0}, @@ -7890,8 +7890,8 @@ native_image_p (Lisp_Object object) struct image_keyword fmt[NATIVE_IMAGE_LAST]; memcpy (fmt, native_image_format, sizeof fmt); - if (!parse_image_spec (object, fmt, 10, Qnative_image)) - return 0; + if (!parse_image_spec (object, fmt, NATIVE_IMAGE_LAST, Qnative_image)) + return false; /* Must specify either the :data or :file keyword. */ return fmt[NATIVE_IMAGE_FILE].count + fmt[NATIVE_IMAGE_DATA].count == 1;