Skip to content

Unalligned access in Mod_LoadMarksurfaces #165

Description

@andrey-budko

I noticed that Mod_LoadMarksurfaces can potentially perform an unaligned access. See this comment for details:
andrei-drexler#570 (comment)

Corresponding part of the code

short *in = (short *)(mod_base + l->fileofs);
if ((uintptr_t)in & 1)
    __debugbreak();

As far as I understand, this is UB (at least), and I tried to port Novum's fix Novum/vkQuake@c1b0234 in case you're interested.

andrey-budko@f61f19f

I did all the changes by hand, so be careful and recheck it in case you are interested in such huge changes. Most changes are fairly trivial, but Mod_LoadTextures required extra care as the code differs significantly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions