{
if (unlikely(pc + sizeof(struct return_op)
> start_pc + bytecode->len)) {
- ret = -EINVAL;
+ ret = -ERANGE;
}
break;
}
{
if (unlikely(pc + sizeof(struct binary_op)
> start_pc + bytecode->len)) {
- ret = -EINVAL;
+ ret = -ERANGE;
}
break;
}
{
if (unlikely(pc + sizeof(struct unary_op)
> start_pc + bytecode->len)) {
- ret = -EINVAL;
+ ret = -ERANGE;
}
break;
}
{
if (unlikely(pc + sizeof(struct logical_op)
> start_pc + bytecode->len)) {
- ret = -EINVAL;
+ ret = -ERANGE;
}
break;
}
{
if (unlikely(pc + sizeof(struct load_op) + sizeof(struct field_ref)
> start_pc + bytecode->len)) {
- ret = -EINVAL;
+ ret = -ERANGE;
}
break;
}
if (unlikely(pc + sizeof(struct load_op)
> start_pc + bytecode->len)) {
- ret = -EINVAL;
+ ret = -ERANGE;
break;
}
str_len = strnlen(insn->data, maxlen);
if (unlikely(str_len >= maxlen)) {
/* Final '\0' not found within range */
- ret = -EINVAL;
+ ret = -ERANGE;
}
break;
}
{
if (unlikely(pc + sizeof(struct load_op) + sizeof(struct literal_numeric)
> start_pc + bytecode->len)) {
- ret = -EINVAL;
+ ret = -ERANGE;
}
break;
}
{
if (unlikely(pc + sizeof(struct load_op) + sizeof(struct literal_double)
> start_pc + bytecode->len)) {
- ret = -EINVAL;
+ ret = -ERANGE;
}
break;
}
{
if (unlikely(pc + sizeof(struct cast_op)
> start_pc + bytecode->len)) {
- ret = -EINVAL;
+ ret = -ERANGE;
}
break;
}
start_pc = &bytecode->data[0];
for (pc = next_pc = start_pc; pc - start_pc < bytecode->len;
pc = next_pc) {
- if (bytecode_validate_overflow(bytecode, start_pc, pc) != 0) {
- ERR("filter bytecode overflow\n");
- ret = -EINVAL;
+ ret = bytecode_validate_overflow(bytecode, start_pc, pc);
+ if (ret != 0) {
+ if (ret == -ERANGE)
+ ERR("filter bytecode overflow\n");
goto end;
}
dbg_printf("Validating op %s (%u)\n",