1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2025-02-24 15:55:41 -05:00

Multiboot 2 tags are aligned

This commit is contained in:
Alex Kotov 2020-11-28 07:41:07 +05:00
parent 9f2925be53
commit 20a572532b
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 10 additions and 8 deletions

View file

@ -24,8 +24,7 @@ unsigned char KernAux_Multiboot2_is_valid(
}
tag_base = (struct KernAux_Multiboot2_TagBase*)(
(void*)tag_base +
tag_base->size
(void*)tag_base + ((tag_base->size + 7) & ~7)
);
}

View file

@ -80,8 +80,7 @@ void KernAux_Multiboot2_print(
KernAux_Multiboot2_TagBase_print(tag_base, print);
tag_base = (struct KernAux_Multiboot2_TagBase*)(
(void*)tag_base +
tag_base->size
(void*)tag_base + ((tag_base->size + 7) & ~7)
);
}
}

View file

@ -516,10 +516,11 @@ static const struct {
struct KernAux_Multiboot2 multiboot2;
struct KernAux_Multiboot2_Tag_BasicMemoryInfo tag_basic_memory_info;
struct KernAux_Multiboot2_Tag_BIOSBootDevice tag_bios_boot_device;
unsigned char _align1[4];
struct KernAux_Multiboot2_Tag_None tag_none;
} multiboot2_with_more_additional_tags_valid = {
.multiboot2 = {
.total_size = 8 + 16 + 20 + 8,
.total_size = 8 + 16 + (20 + 4) + 8,
.reserved1 = 0,
},
.tag_basic_memory_info = {
@ -591,10 +592,11 @@ static const struct {
struct KernAux_Multiboot2_Tag_BasicMemoryInfo tag_basic_memory_info;
struct KernAux_Multiboot2_Tag_None tag_none1;
struct KernAux_Multiboot2_Tag_BIOSBootDevice tag_bios_boot_device;
unsigned char _align1[4];
struct KernAux_Multiboot2_Tag_None tag_none2;
} multiboot2_with_early_none_tag_invalid = {
.multiboot2 = {
.total_size = 8 + 16 + 8 + 20 + 8,
.total_size = 8 + 16 + 8 + (20 + 4) + 8,
.reserved1 = 0,
},
.tag_basic_memory_info = {
@ -632,10 +634,11 @@ static const struct {
struct KernAux_Multiboot2 multiboot2;
struct KernAux_Multiboot2_Tag_BasicMemoryInfo tag_basic_memory_info;
struct KernAux_Multiboot2_Tag_BIOSBootDevice tag_bios_boot_device;
unsigned char _align1[4];
struct KernAux_Multiboot2_Tag_None tag_none;
} multiboot2_with_more_additional_tags_invalid_size_too_big = {
.multiboot2 = {
.total_size = 8 + 16 + 20 + 8 + 1,
.total_size = 8 + 16 + (20 + 4) + 8 + 1,
.reserved1 = 0,
},
.tag_basic_memory_info = {
@ -667,10 +670,11 @@ static const struct {
struct KernAux_Multiboot2 multiboot2;
struct KernAux_Multiboot2_Tag_BasicMemoryInfo tag_basic_memory_info;
struct KernAux_Multiboot2_Tag_BIOSBootDevice tag_bios_boot_device;
unsigned char _align1[4];
struct KernAux_Multiboot2_Tag_None tag_none;
} multiboot2_with_more_additional_tags_invalid_size_too_small = {
.multiboot2 = {
.total_size = 8 + 16 + 20 + 8 - 1,
.total_size = 8 + 16 + (20 + 4) + 8 - 1,
.reserved1 = 0,
},
.tag_basic_memory_info = {