Fix decreasing loop.
As pointed out by rickyz@, we were comparing past the beginning of the
array.
Also add a bunch of unit tests for the label functionality.
Bug: 31955943
Test: syscall_filter_unittest
Change-Id: Iece922372c6548aff36cf2f2650e37d2f25eaae7
diff --git a/syscall_filter.c b/syscall_filter.c
index 37b8136..e42f017 100644
--- a/syscall_filter.c
+++ b/syscall_filter.c
@@ -520,7 +520,8 @@
free_block_list(head);
free_block_list(arg_blocks);
- bpf_resolve_jumps(&labels, final_filter, final_filter_len);
+ if (bpf_resolve_jumps(&labels, final_filter, final_filter_len) < 0)
+ return -1;
free_label_strings(&labels);