Skip to content

Undefined Behaviour in volk_8u_x4_conv_k7_r2_8u #674

@argilo

Description

@argilo

UBSAN reports undefined behaviour in this code:

d->w[i / (sizeof(unsigned int) * 8 / 2) +
s * (sizeof(decision_t) / sizeof(unsigned int))] |=

Here w is an unsigned int[2], and the s * (sizeof(decision_t) / sizeof(unsigned int)) calculation intentionally reaches outside the bounds of the array to access the sth element of the outer decision_t array d.

It looks like this hack became necessary because sizeof(decision_t) is 8, and yet it is marked as being 16-byte aligned; because of this, accessing d[1] (or any other odd offset) fails due to misalignment. I suspect that the 16-byte alignment of decision_t is incorrect or unnecessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions