From cbc2be34ed9e47f5b17d0955bf3496d735359795 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sat, 3 Sep 2022 23:33:29 +0200 Subject: libcamera: control_serializer: store/load all ControlValue types The min/max/def ControlValue of a ControlInfo can take arbitrary types that are different from each other and different from the ControlId type. The serialiser serialises these ControlValue separately by their type but does not store the type. The deserialiser assumes that ControlValue types match the ControlId type. If this is not the case, deserialisation will try to deserialise values of the wrong type. Fix this by serialising each of the min/max/def ControlValue's ControlType and storing it just before the serialised ControlValue. Fixes: https://bugs.libcamera.org/show_bug.cgi?id=137 Signed-off-by: Christian Rauch Tested-by: Paul Elder Reviewed-by: Paul Elder Reviewed-by: Umang Jain Signed-off-by: Paul Elder --- include/libcamera/internal/control_serializer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/libcamera/internal/control_serializer.h b/include/libcamera/internal/control_serializer.h index 99e57fee..a38ca6b0 100644 --- a/include/libcamera/internal/control_serializer.h +++ b/include/libcamera/internal/control_serializer.h @@ -47,9 +47,9 @@ private: static void store(const ControlValue &value, ByteStreamBuffer &buffer); static void store(const ControlInfo &info, ByteStreamBuffer &buffer); - ControlValue loadControlValue(ControlType type, ByteStreamBuffer &buffer, + ControlValue loadControlValue(ByteStreamBuffer &buffer, bool isArray = false, unsigned int count = 1); - ControlInfo loadControlInfo(ControlType type, ByteStreamBuffer &buffer); + ControlInfo loadControlInfo(ByteStreamBuffer &buffer); unsigned int serial_; unsigned int serialSeed_; -- cgit v1.2.1