bios_table: pldm_bios_table_iter_next(): Invalid entry halts iteration

The attribute iterator machinary prevented misbehaviour through use of
assert(). The attribute list is maintained as a linear sequence of
variably sized data structures that are packed against each other in the
address space. The iterator is implemented by assigning a callback that
can determine the length of each entry as appropriate for the entry's
type, and then moving the iterator's cursor between elements.

The length derivation for some elements was protected by assert(). To
avoid the asserts we rework the length callback prototype to return
a signed size value and indicate an error state with a negative size.

pldm_bios_table_iter_next() is reworked to detect the error case on
deriving the element size (negative size) and behave as if the iterator
has terminated.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I80db3fe179201b169acc68c68633d8dd3f3a6334
diff --git a/tests/meson.build b/tests/meson.build
index 78d65ee..834f19c 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -46,6 +46,11 @@
        workdir: meson.current_source_dir())
 endforeach
 
+test('bios_table_iter', executable('bios_table_iter',
+                                   'bios_table_iter.c',
+                                   implicit_include_directories: false,
+                                   include_directories: src_includes))
+
 test('msgbuf_generic', executable('msgbuf_generic',
                                   'msgbuf_generic.c',
                                   implicit_include_directories: false,