MCPcopy Create free account
hub / github.com/chromium/crashpad / StringDataInChildProcess

Class StringDataInChildProcess

util/process/process_memory_test.cc:453–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

451constexpr size_t kChildProcessStringLength = 10;
452
453class StringDataInChildProcess {
454 public:
455 // This constructor only makes sense in the child process.
456 explicit StringDataInChildProcess(const char* cstring, bool valid)
457 : address_(FromPointerCast<VMAddress>(cstring)) {
458 if (valid) {
459 memcpy(expected_value_, cstring, kChildProcessStringLength + 1);
460 } else {
461 memset(expected_value_, 0xff, kChildProcessStringLength + 1);
462 }
463 }
464
465 void Write(FileHandle out) {
466 CheckedWriteFile(out, &address_, sizeof(address_));
467 CheckedWriteFile(out, &expected_value_, sizeof(expected_value_));
468 }
469
470 static StringDataInChildProcess Read(FileHandle in) {
471 StringDataInChildProcess str;
472 EXPECT_TRUE(ReadFileExactly(in, &str.address_, sizeof(str.address_)));
473 EXPECT_TRUE(
474 ReadFileExactly(in, &str.expected_value_, sizeof(str.expected_value_)));
475 return str;
476 }
477
478 VMAddress address() const { return address_; }
479 std::string expected_value() const { return expected_value_; }
480
481 private:
482 StringDataInChildProcess() : address_(0), expected_value_() {}
483
484 VMAddress address_;
485 char expected_value_[kChildProcessStringLength + 1];
486};
487
488void DoCStringUnmappedTestSetup(
489 void* page,

Callers 1

Calls

no outgoing calls

Tested by 1