79104028

Date: 2024-10-19 01:14:23
Score: 1
Natty:
Report link

@MichaelPetch provided this comment (Huge Appreciation)

Upon further inspection there is a similar casting issue (refering to previous comment) here as well: tag += tag->size; You could do something like tag = (mb2_tag *) ((uint8_t *) tag + ((tag->size + 7) & ~7)))

After adjusting the code to this new traversal in multiboot2.c

// multiboot2.c

void mb2_traverse(mb2_info_header *mbd, uint32_t magic)
{
    if (magic != 0x36D76289)
    {
        tty_printf("Multiboot2 Magic Number is invalid");
        asm volatile ("hlt");
    }
    tty_printf("MB2 [%d]\n", mbd->total_size);
    uint64_t mb2_end = mbd->total_size + (uint64_t)mbd;

    mb2_tag *tag = (mb2_tag*)(mbd + sizeof(mb2_info_header));
    while ((uint64_t)tag < mb2_end)
    {
        tty_printf("TAG %d\t[%d] @\t%x\n", tag->type, tag->size, tag);
        if (tag->type == 0)
            break;
        switch (tag->type) {
            // ...
            default: break;
        }
        tag = (mb2_tag *) ((uint8_t *) tag + ((tag->size + 7) & ~7));
    }
}

Yeilds the results:
Result Screenshot

Reasons:
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: IsCoffeeTho