@@ -701,6 +701,20 @@ bool ControlInfoMap::validate()
? ControlTypeInteger32 : id->type();
const ControlInfo &info = ctrl.second;
+ if (info.min().type() != info.max().type()) {
+ LOG(Controls, Error)
+ << "Control " << utils::hex(id->id())
+ << " range types mismatch";
+ return false;
+ }
+
+ if (info.def().type() != ControlTypeNone && (info.min().type() != info.def().type())) {
+ LOG(Controls, Error)
+ << "Control " << utils::hex(id->id())
+ << " default value and info type mismatch";
+ return false;
+ }
+
if (info.min().type() != rangeType) {
LOG(Controls, Error)
<< "Control " << utils::hex(id->id())
ControlInfoMap::validate only checks the 'min' type against the ControlId type. Extend this with checks against the 'max' type and the 'def' type, if a default is specified. This forces the min/max bounds to have the same type as the controlled value, but leaves the default optional. Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de> --- src/libcamera/controls.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.34.1