Skip to content

Incomplete data hashing #1

@R0flan4k

Description

@R0flan4k

it's possible to invade stack data without error message.

Steps to reproduce
In task5.cpp:

    for(i = 0; i < 6; i++)
    {
        stack_push(&stk, i + 10);
    }

    stk.data[5] = 0xAB0BA;

    for(; i < 20; i++)
    {
        stack_push(&stk, i + 10);
    }

Expected Behaviour
An error was expected after changing the value of stk.data[5].

Current Behaviour
stack_is_invalid() doesn't detect changes.

Possible solution
oat_hash(stk->data, (size_t) stk->capacity) doesn't fully hash the data. Expected function call:

    oat_hash(stk->data, (size_t) stk->capacity * sizeof(elem_t));

Version: commit 5d29b89

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