Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(796)

Unified Diff: minidump/test/minidump_writable_test_util.cc

Issue 708803002: minidump: stronger checking for MinidumpWritableAtRVA<>() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « minidump/test/minidump_writable_test_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: minidump/test/minidump_writable_test_util.cc
diff --git a/minidump/test/minidump_writable_test_util.cc b/minidump/test/minidump_writable_test_util.cc
index f1389908dc623399e07e51007ba174c97d7de07c..25fc10c1b721125e1f61823d1665fd59aedb255b 100644
--- a/minidump/test/minidump_writable_test_util.cc
+++ b/minidump/test/minidump_writable_test_util.cc
@@ -22,6 +22,20 @@
namespace crashpad {
namespace test {
+namespace {
+
+//! \brief Returns an untyped minidump object located within a minidump file’s
+//! contents, where the offset of the object is known.
+//!
+//! \param[in] file_contents The contents of the minidump file.
+//! \param[in] rva The offset within the minidump file of the desired object.
+//!
+//! \return If \a rva is within the range of \a file_contents, returns a pointer
+//! into \a file_contents at offset \a rva. Otherwise, raises a gtest
+//! assertion failure and returns `nullptr`.
+//!
+//! Do not call this function. Use the typed version, MinidumpWritableAtRVA<>(),
+//! or another type-specific function.
const void* MinidumpWritableAtRVAInternal(const std::string& file_contents,
RVA rva) {
if (rva >= file_contents.size()) {
@@ -32,6 +46,8 @@ const void* MinidumpWritableAtRVAInternal(const std::string& file_contents,
return &file_contents[rva];
}
+} // namespace
+
const void* MinidumpWritableAtLocationDescriptorInternal(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location,
« no previous file with comments | « minidump/test/minidump_writable_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698