Skip to content

[utils] LoadFileData() segfaults when dataSize param is NULL #3365

Closed

Description

@danielchasehooper

Issue description

LoadFileData segfaults when dataSize param is NULL. It'd be more helpful if it returned NULL

Environment

macOS

Code Example

char *data = LoadFileData("file.txt", NULL);

Activity

  1. raysan5 commented on Oct 2, 2023

    @raysan5
    Owner

    For most of the raylib functions is up to the user to validate the inputs, if raylib should consider all possible bad-use scenarios it would require reviewing most of the library functions and it will increase source-code complexity.

  2. changed the title [-]LoadFileData segfaults when dataSize param is NULL[/-] [+][utils] `LoadFileData()` segfaults when dataSize param is `NULL`[/+] on Oct 3, 2023
  3. raysan5 commented on Oct 3, 2023

    @raysan5
    Owner

    It's up to the user to avoid this kind of bad-use cases, same issue will happen with most raylib functions receiving some pointer.

  4. vittorioromeo commented on May 2, 2024

    @vittorioromeo

    It's up to the user to avoid this kind of bad-use cases, same issue will happen with most raylib functions receiving some pointer.

    @raysan5: raylib should at the very least assert in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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