Skip to content

Fix null pointer crash in ScopedPrematureExitFile when file creation fails#4910

Open
hey-chocopie wants to merge 1 commit intogoogle:mainfrom
hey-chocopie:main
Open

Fix null pointer crash in ScopedPrematureExitFile when file creation fails#4910
hey-chocopie wants to merge 1 commit intogoogle:mainfrom
hey-chocopie:main

Conversation

@hey-chocopie
Copy link

Summary

  • Add null check before fwrite and fclose in
    ScopedPrematureExitFile
  • Prevents crash when TEST_PREMATURE_EXIT_FILE points to invalid
    path

Related Issue

Fixes #4909

…fails

  When TEST_PREMATURE_EXIT_FILE is set and posix::FOpen fails,
  fwrite and
  fclose are called on nullptr without null check.

  Add null check before fwrite and fclose to ignore file
  creation failures
  as intended by the existing comment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Crash when TEST_PREMATURE_EXIT_FILE points to invalid path

1 participant