android / android/ndk

gtest death tests segfault if the sdcard is removed

Open
#210 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
2.3k
Forks
310
PR merge metrics
No merged PRs in 30d

Description

https://android.googlesource.com/platform/ndk/+/76ca48a9270bead748bdc8feec16ee40e0ae6f98/sources/third_party/googletest/googletest/src/gtest-port.cc#552
https://android.googlesource.com/platform/ndk/+/76ca48a9270bead748bdc8feec16ee40e0ae6f98/sources/third_party/googletest/googletest/src/gtest-port.cc#578

gtest sets up a path in /sdcard, `fopen`s it, and then doesn't check the result before using it. If the device has a removable sdcard and the sdcard isn't present, this will segfault.

Note that the above links are the NDK's old gtest fork, but this code has not changed upstream.

I need to send two patches upstream: one to check the `fopen` result and print a useful message if it fails, and another to fall back to /data/local/tmp if it fails on Android.

Contributor guide

Open the contributing guide

Research direction

Start in googletest/src/gtest-port.cc at the two linked locations and trace the death-test file setup around /sdcard. Verify the fopen result is handled with a useful failure message and that Android can fall back to /data/local/tmp when needed; the two upstream patches should cover these cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, cpp
Domain
mobile-dev, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.