Hi Toomas,

-----Original Message-----
From: <owner-src-committ...@freebsd.org> on behalf of Toomas Soome 
<tso...@freebsd.org>
Date: 2021-01-16, Saturday at 00:23
To: <src-committ...@freebsd.org>, <dev-commits-src-...@freebsd.org>, 
<dev-commits-src-main@FreeBSD.org>
Subject: git: ad1ebbe5cea8 - main - loader: create local copy of mode list 
provided by vbeinfoblock

    The branch main has been updated by tsoome:

    URL: 
https://cgit.FreeBSD.org/src/commit/?id=ad1ebbe5cea8ffac0037966990ddf0f80faa55d5

    commit ad1ebbe5cea8ffac0037966990ddf0f80faa55d5
    Author:     Toomas Soome <tso...@freebsd.org>
    AuthorDate: 2021-01-16 10:18:32 +0000
    Commit:     Toomas Soome <tso...@freebsd.org>
    CommitDate: 2021-01-16 10:23:22 +0000

        loader: create local copy of mode list provided by vbeinfoblock

        Apparently some systems do corrupt mode list memory area, so we need
        to use local copy instead.

...

    +   vbe_mode_list_size = (uintptr_t)p - (uintptr_t)ml;
    +   vbe_mode_list = malloc(vbe_mode_list_size);
    +   if (vbe_mode_list == NULL) {
    +           free(vbe);
    +           vbe = NULL;
    +           free(vbe_mode);
    +           vbe_mode = NULL;
    +   }
    +   bcopy(ml, vbe_mode_list, vbe_mode_list_size);
    +
    +   /* reset VideoModePtr, so we will not have chance to use bad data. */
    +   vbe->VideoModePtr = 0;

If allocation of vbe_mode_list failed, you're freeing things that were 
allocated before it, but then you're continuing on. The very next thing you do 
is the bcopy(), which dereferences vbe_mode_list, which is NULL because of the 
allocation failure.

That doesn't seem right.

Thanks,

Ravi (rpokala@)


_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to