Skip to content

Crash leads by reading "/cpu/info" #317

@Plat1numStar

Description

@Plat1numStar
    bytes    = fread (cpuinfo, 1, sizeof (cpuinfo), infofile);
    fclose (infofile);

    if (0 == bytes || CPUINFO_BUFFER_SIZE == bytes)
    {
        fprintf (stderr, "ERROR: Couldn't read the file \"/proc/cpuinfo\". NE10_init() failed.\n");
        return NE10_ERR;
    }

Hello developer,
Recently, I found a crash that occurs on some devices.
After some investigation, the evidence reveals a potentially fragile check shown above.
If the CPU info read from the file is larger than expected and reaches CPUINFO_BUFFER_SIZE, the initialization fails.

Would it be possible to change this check, or allocate a slightly larger buffer, for example CPUINFO_BUFFER_SIZE + 1?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions