Skip to content

negative value cast to unsigned when calculating bytes #35

Description

@thirtytwobits

https://github.com/mattconte/tlsf/blob/master/tlsf.c#L1100 bytes - tlsf_size() where bytes < tlsf_size() yields a junk result in the tlsf_add_pool function.

Given a value of 40 bytes this leads to segfaults. Given a value of 4096 bytes this leads to https://github.com/mattconte/tlsf/blob/master/tlsf.c#L997 reporting that the buffer is too large. (this reproduced on aarch64).

I'd add a check that bytes is > tlsf_size() and document that the buffer provided must be greater than this value.

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