Skip to content

Heap-buffer-overflow and Misaligned address for tensor insert() #514

Open
@adadima

Description

@adadima

The failing example is

Tensor<int> v("v", {N}, Format({Dense}));
for (int a=0; a < N; a++) {
        v.insert({a}, a);
 }
 v.pack();

And here's the stacktrace:

Screenshot 2022-03-03 at 18 01 12

Note: Looking at this it, I can see an issue with the set method on TypedComponent which gets called whenever you insert a value into a vector. The given value is cast to union ComponentTypeUnion. Maybe there is an alignment issue if the value you want to insert is just a 4 byte int ( as in the above example ) and the ComponentTypeUnion is not 4 byte aligned ( which it probably isn't since it needs to potentially store larger values ). Screenshot for this error:

Screenshot 2022-03-25 at 15 41 59

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions