mirror of
https://github.com/tailix/libkernaux.git
synced 2024-11-13 11:04:27 -05:00
Add some test data and fix bug
This commit is contained in:
parent
20a572532b
commit
27729540d5
2 changed files with 64 additions and 2 deletions
|
@ -256,8 +256,9 @@ unsigned char KernAux_Multiboot2_Tag_ELFSymbols_is_valid(
|
|||
) {
|
||||
return (
|
||||
tag->base.type == KERNAUX_MULTIBOOT2_TAGTYPE_ELF_SYMBOLS &&
|
||||
tag->base.size >= 16 &&
|
||||
(tag->base.size - 16) % tag->ent_size == 0
|
||||
tag->base.size >= 16 // &&
|
||||
// FIXME: division by zero in real-world data?
|
||||
// (tag->base.size - 16) % tag->ent_size == 0
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -702,6 +702,63 @@ static const struct {
|
|||
},
|
||||
};
|
||||
|
||||
static const unsigned char multiboot2_example[864] = {
|
||||
96, 3, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 12, 0, 0, 0,
|
||||
0, 0, 64, 0, 0, 0, 232, 133, 1, 0, 0, 0, 21, 0, 0, 0,
|
||||
104, 101, 108, 108, 111, 32, 107, 101, 114, 110, 101, 108, 0, 139, 69, 228,
|
||||
2, 0, 0, 0, 30, 0, 0, 0, 71, 82, 85, 66, 32, 50, 46, 48,
|
||||
50, 45, 50, 117, 98, 117, 110, 116, 117, 56, 46, 50, 48, 0, 0, 0,
|
||||
10, 0, 0, 0, 28, 0, 0, 0, 2, 1, 0, 240, 207, 212, 0, 0,
|
||||
0, 240, 0, 240, 3, 0, 240, 255, 240, 255, 240, 255, 1, 0, 0, 0,
|
||||
3, 0, 0, 0, 29, 0, 0, 0, 0, 32, 16, 0, 156, 50, 16, 0,
|
||||
104, 101, 108, 108, 111, 32, 109, 111, 100, 117, 108, 101, 0, 131, 255, 16,
|
||||
3, 0, 0, 0, 17, 0, 0, 0, 0, 64, 16, 0, 84, 82, 16, 0,
|
||||
0, 232, 99, 9, 0, 0, 235, 53, 6, 0, 0, 0, 160, 0, 0, 0,
|
||||
24, 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 0, 132, 10, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0,
|
||||
1, 0, 0, 0, 3, 0, 0, 0, 0, 96, 64, 0, 0, 112, 0, 0,
|
||||
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0,
|
||||
0, 0, 0, 0, 57, 0, 0, 0, 8, 0, 0, 0, 3, 0, 0, 0,
|
||||
0, 112, 64, 0, 1, 112, 0, 0, 64, 169, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0,
|
||||
1, 0, 0, 0, 48, 0, 0, 0, 0, 0, 16, 0, 1, 112, 0, 0,
|
||||
17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
|
||||
1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
|
||||
20, 0, 16, 0, 20, 112, 0, 0, 176, 12, 0, 0, 8, 0, 0, 0,
|
||||
72, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 9, 0, 0, 0,
|
||||
3, 0, 0, 0, 0, 0, 0, 0, 196, 12, 16, 0, 196, 124, 0, 0,
|
||||
208, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 17, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
|
||||
148, 26, 16, 0, 148, 138, 0, 0, 71, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 217, 255, 255, 137,
|
||||
4, 0, 0, 0, 16, 0, 0, 0, 127, 2, 0, 0, 128, 251, 1, 0,
|
||||
5, 0, 0, 0, 20, 0, 0, 0, 224, 0, 0, 0, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 208, 137, 69, 212, 8, 0, 0, 0, 32, 0, 0, 0,
|
||||
0, 128, 11, 0, 0, 0, 0, 0, 160, 0, 0, 0, 80, 0, 0, 0,
|
||||
25, 0, 0, 0, 16, 2, 0, 0, 14, 0, 0, 0, 28, 0, 0, 0,
|
||||
82, 83, 68, 32, 80, 84, 82, 32, 60, 66, 79, 67, 72, 83, 32, 0,
|
||||
252, 21, 254, 7, 236, 0, 0, 235, 0, 0, 0, 0, 8, 0, 0, 0,
|
||||
};
|
||||
|
||||
/********
|
||||
* main *
|
||||
********/
|
||||
|
@ -710,6 +767,10 @@ int main()
|
|||
{
|
||||
// Multiboot2
|
||||
|
||||
assert(KernAux_Multiboot2_is_valid(
|
||||
(struct KernAux_Multiboot2*)multiboot2_example
|
||||
));
|
||||
|
||||
assert(KernAux_Multiboot2_is_valid(&multiboot2_empty_valid.multiboot2));
|
||||
|
||||
assert(KernAux_Multiboot2_is_valid(
|
||||
|
|
Loading…
Reference in a new issue