Compilers complain about ranges starting at 0 for unsigned types,
since an unsigned type is never less than 0. The max property
implicitly makes 0 the lower bound when used with unsigned types.
# array
"range" => ["ELEMENT"],
+ "max" => ["ELEMENT"],
"size_is" => ["ELEMENT"],
"string" => ["ELEMENT"],
"noheader" => ["ELEMENT"],
# array
"range" => ["ELEMENT"],
+ "max" => ["ELEMENT"],
"size_is" => ["ELEMENT"],
"string" => ["ELEMENT"],
"noheader" => ["ELEMENT"],
$self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value out of range\");");
$self->pidl("}");
}
+ if (my $max = has_property($e, "max")) {
+ $var_name = get_value_of($var_name);
+ $self->pidl("if ($var_name > $max) {");
+ $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value out of range\");");
+ $self->pidl("}");
+ }
} else {
$self->ParseTypePull($l->{DATA_TYPE}, $ndr, $var_name, $primitives, $deferred);
}