Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Stack overflow in CreateDirectoriesRecursively #4262

Open
elupus opened this issue Jun 1, 2023 · 0 comments · May be fixed by #4263
Open

[Bug]: Stack overflow in CreateDirectoriesRecursively #4262

elupus opened this issue Jun 1, 2023 · 0 comments · May be fixed by #4263
Assignees

Comments

@elupus
Copy link
Contributor

elupus commented Jun 1, 2023

Describe the issue

Asking google test to output to a non existing path, on a system with no notion of "./" being a path causes FilePath::CreateDirectoriesRecursively to end up in an infinite loop with stack overflow.

Steps to reproduce the problem

Somewhat hard.

  • Run on an embedded system with file support, but no concept on a current directory named "./".
  • Ask google-test to output xml to a non existing path.

What version of GoogleTest are you using?

6092810

Its also patch in a small way to work around: #1372

What operating system and version are you using?

rt-kernel

What compiler and version are you using?

arm-eabi-gcc (rt-collab toolbox 2022.1-0-gf81ad3e) 10.4.0

What build system are you using?

cmake version 3.25.0

Additional context

When creating directories recursively the stop condition is an empty pathname:

if (pathname_.length() == 0 || this->DirectoryExists()) {

However, RemoveFileName() function will never end up with an empty pathname, but a ./ separator.

dir = kCurrentDirectoryString;

elupus added a commit to elupus/googletest that referenced this issue Jun 1, 2023
@elupus elupus linked a pull request Jun 1, 2023 that will close this issue
elupus added a commit to elupus/googletest that referenced this issue Jun 2, 2023
elupus added a commit to rtlabs-com/googletest that referenced this issue Jun 19, 2023
elupus added a commit to rtlabs-com/googletest that referenced this issue Jun 19, 2023
elupus added a commit to rtlabs-com/googletest that referenced this issue Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants