mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-29 00:32:35 +08:00
Mark Mentovai
1abaf22e28
Use readdir() instead of readdir_r() on all (POSIX) platforms
readdir_r() is a thread-safe version of readdir(), although readdir() is not particularly thread-unsafe with most usage. The dirent* returned by readdir() can only be invalidated by a subsequent readdir() or closedir() on the same DIR*. In typical usage, where a returned dirent* is used exclusively within a loop around readdir() and is not expected to outlive that loop, there are no lifetime or thread-safety issues with the use of readdir(). readdir_r() may be harmful in certain situations because its buffer is not explicitly sized, and attempts to provide a suitably sized buffer dynamically (which, incidentally, our code did not do) are subject to a race condition. https://elliotth.blogspot.com/2012/10/how-not-to-use-readdirr3.html https://womble.decadent.org.uk/readdir_r-advisory.html glibc has already deprecated readdir_r(), and all Linux (including Android) code was already using readdir(). This change eliminates variant codepaths. It delegates buffer sizing (which we weren’t doing correctly) to the C library, which also has more options at its disposal to avoid races in sizing that buffer. Change-Id: I4fca8948454116360180ad0017f226d06727ef81 Reviewed-on: https://chromium-review.googlesource.com/705756 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Crashpad
Crashpad is a crash-reporting system.
Documentation
- Project status
- Developing Crashpad: instructions for getting the source code, building, testing, and contributing to the project.
- Crashpad interface documentation
- Crashpad tool man pages
- Crashpad overview design
Source Code
Crashpad’s source code is hosted in a Git repository at https://chromium.googlesource.com/crashpad/crashpad.
Other Links
- Bugs can be reported at the Crashpad issue tracker.
- The Crashpad Buildbots perform automated builds and tests.
- crashpad-dev is the Crashpad developers’ mailing list.
Description
Languages
C++
92.6%
Objective-C++
2.5%
C
2%
Python
1.7%
Assembly
0.9%
Other
0.3%