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

Unified Diff: third_party/protobuf/src/google/protobuf/arena_test_util.h

Issue 2600753002: Reverts third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Created 4 years 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
Index: third_party/protobuf/src/google/protobuf/arena_test_util.h
diff --git a/third_party/protobuf/src/google/protobuf/arena_test_util.h b/third_party/protobuf/src/google/protobuf/arena_test_util.h
index 8c9f7698c5da6cd2fd25e57cf38afc34ce718e9d..690cc706ee5f2d029752fe6f1b323130046938e5 100644
--- a/third_party/protobuf/src/google/protobuf/arena_test_util.h
+++ b/third_party/protobuf/src/google/protobuf/arena_test_util.h
@@ -31,40 +31,9 @@
#ifndef GOOGLE_PROTOBUF_ARENA_TEST_UTIL_H__
#define GOOGLE_PROTOBUF_ARENA_TEST_UTIL_H__
-#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/arena.h>
namespace google {
namespace protobuf {
-
-template <typename T, bool use_arena>
-void TestParseCorruptedString(const T& message) {
- int success_count = 0;
- string s = message.SerializeAsString();
- const int kMaxIters = 900;
- const int stride = s.size() <= kMaxIters ? 1 : s.size() / kMaxIters;
- const int start = stride == 1 || use_arena ? 0 : (stride + 1) / 2;
- for (int i = start; i < s.size(); i += stride) {
- for (int c = 1 + (i % 17); c < 256; c += 2 * c + (i & 3)) {
- s[i] ^= c;
- google::protobuf::Arena arena;
- T* message =
- google::protobuf::Arena::CreateMessage<T>(use_arena ? &arena : NULL);
- if (message->ParseFromString(s)) {
- ++success_count;
- }
- if (!use_arena) {
- delete message;
- }
- s[i] ^= c; // Restore s to its original state.
- }
- }
- // This next line is a low bar. But getting through the test without crashing
- // due to use-after-free or other bugs is a big part of what we're checking.
- GOOGLE_CHECK_GT(success_count, 0);
-}
-
namespace internal {
class NoHeapChecker {
« no previous file with comments | « third_party/protobuf/src/google/protobuf/arena.cc ('k') | third_party/protobuf/src/google/protobuf/arena_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698