Skip to content

Commit

Permalink
cgen: fix instructions count for double instructions
Browse files Browse the repository at this point in the history
Some BPF instructions are composed of 2 bpf_insn structures. The
bytecode dump logic count those as a single instructions, messing up the
index displayed next to the instruction.

Fix this bug by incrementing the instruction index twice in case of
double instruction.
  • Loading branch information
qdeslandes committed Oct 26, 2024
1 parent 15dd233 commit d00a66c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/bpfilter/cgen/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void bf_program_dump_bytecode(const struct bf_program *program)

if (double_insn) {
double_insn = false;
++bfdd.idx;
continue;
}

Expand Down

0 comments on commit d00a66c

Please sign in to comment.