From d40a598970b04bfe3a867a5e12debc45c149b46b Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Tue, 14 Mar 2023 12:19:48 +0000 Subject: plugins: Simplify plugin/codec API versioning Replace the minimum version bound with a check on the size of the API struct. The version only needs to be incremented for ABI breaking changes. Additions to the API won't need to touch the version number, resulting in fewer merge conflicts. Change-Id: I916a04a7bf5890dcf5d615ce30087643165f8e1f --- apps/plugins/imageviewer/image_decoder.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apps/plugins/imageviewer/image_decoder.c') diff --git a/apps/plugins/imageviewer/image_decoder.c b/apps/plugins/imageviewer/image_decoder.c index eab1c01dbc..0c1776daaa 100644 --- a/apps/plugins/imageviewer/image_decoder.c +++ b/apps/plugins/imageviewer/image_decoder.c @@ -155,7 +155,10 @@ const struct image_decoder *load_decoder(struct loader_info *loader_info) goto error_close; } - if (lc_hdr->api_version != IMGDEC_API_VERSION) + if (lc_hdr->api_version != IMGDEC_API_VERSION || + hdr->img_api_size > sizeof(struct imgdec_api) || + hdr->plugin_api_version != PLUGIN_API_VERSION || + hdr->plugin_api_size > sizeof(struct plugin_api)) { rb->splashf(2*HZ, "%s decoder: Incompatible version.", name); goto error_close; -- cgit v1.2.3